16 lines
730 B
MySQL
16 lines
730 B
MySQL
|
|
CREATE TABLE IF NOT EXISTS internet_connections_invoice_review_decisions (
|
||
|
|
id BIGSERIAL PRIMARY KEY,
|
||
|
|
run_id BIGINT NOT NULL REFERENCES internet_connections_invoice_sync_runs(id) ON DELETE CASCADE,
|
||
|
|
line_number INTEGER NOT NULL,
|
||
|
|
action VARCHAR(30) NOT NULL
|
||
|
|
CHECK (action IN ('ignore', 'link_existing', 'create_separate')),
|
||
|
|
connection_id INTEGER REFERENCES internet_connections_connections(id) ON DELETE SET NULL,
|
||
|
|
note TEXT,
|
||
|
|
resolved_by_user_id INTEGER,
|
||
|
|
resolved_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
UNIQUE (run_id, line_number)
|
||
|
|
);
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_internet_invoice_review_decisions_run
|
||
|
|
ON internet_connections_invoice_review_decisions(run_id, line_number);
|