No content changes: git diff --ignore-all-space over these files is empty. The churn came from editing on Windows against a repo checked out with LF.
30 lines
966 B
SQL
30 lines
966 B
SQL
-- Migration: 001_init_schema
|
|
-- Description: Initialize schema for documents and ocr_items
|
|
|
|
CREATE TABLE IF NOT EXISTS documents (
|
|
id SERIAL PRIMARY KEY,
|
|
filename VARCHAR(255) UNIQUE NOT NULL,
|
|
upload_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
size INTEGER NOT NULL DEFAULT 0,
|
|
parsed BOOLEAN NOT NULL DEFAULT FALSE,
|
|
metadata JSONB,
|
|
layout_parsing_result JSONB,
|
|
is_sample BOOLEAN NOT NULL DEFAULT FALSE
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS ocr_items (
|
|
id SERIAL PRIMARY KEY,
|
|
document_id INTEGER NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
|
|
row_index INTEGER NOT NULL,
|
|
kode_barang_original VARCHAR(255),
|
|
kode_barang VARCHAR(255),
|
|
nama_barang VARCHAR(255),
|
|
banyak_original VARCHAR(255),
|
|
banyak VARCHAR(255),
|
|
jumlah_original VARCHAR(255),
|
|
jumlah VARCHAR(255),
|
|
is_flagged BOOLEAN NOT NULL DEFAULT FALSE,
|
|
remark VARCHAR(1000),
|
|
UNIQUE(document_id, row_index)
|
|
);
|