Add SQL migration for diagnostic candidate outputs
This commit is contained in:
parent
ebd8a3eed2
commit
746757e19f
|
|
@ -0,0 +1,21 @@
|
|||
CREATE TABLE IF NOT EXISTS document_diagnostic_outputs (
|
||||
id SERIAL PRIMARY KEY,
|
||||
document_id INTEGER NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
|
||||
engine VARCHAR(80) NOT NULL,
|
||||
output_type VARCHAR(80) NOT NULL,
|
||||
version_number INTEGER NOT NULL,
|
||||
file_path TEXT,
|
||||
status VARCHAR(40) NOT NULL DEFAULT 'created',
|
||||
error_message TEXT,
|
||||
metadata_json JSONB DEFAULT '{}'::jsonb,
|
||||
is_selected BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW(),
|
||||
UNIQUE(document_id, engine, output_type, version_number)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_document_diagnostic_outputs_document_id
|
||||
ON document_diagnostic_outputs(document_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_document_diagnostic_outputs_lookup
|
||||
ON document_diagnostic_outputs(document_id, engine, output_type);
|
||||
Loading…
Reference in New Issue