This is a huge change. I was getting really sick of the split between nuisance/water tables when more than half of the data they store is common. I finally bit off the big work of switching it all. This creates a single unified table, publicreport.report and copies the existing report data into it. It also ports existing data from the original tables into the new table. Along with all of this I also overhauled the system for handling asynchronous work to use a LISTEN/NOTIFY connection from the database and a single cache table to avoid ever losing work.
15 lines
581 B
SQL
15 lines
581 B
SQL
-- +goose Up
|
|
ALTER TABLE comms.text_job ADD COLUMN creator_id INTEGER REFERENCES user_(id);
|
|
ALTER TABLE comms.text_job ADD COLUMN report_id INTEGER REFERENCES publicreport.report(id);
|
|
|
|
CREATE TABLE report_text (
|
|
creator_id INTEGER NOT NULL REFERENCES user_(id),
|
|
report_id INTEGER NOT NULL REFERENCES publicreport.report(id),
|
|
text_log_id INTEGER NOT NULL REFERENCES comms.text_log(id),
|
|
PRIMARY KEY(creator_id, report_id, text_log_id)
|
|
);
|
|
-- +goose Down
|
|
DROP TABLE report_text;
|
|
ALTER TABLE comms.text_job DROP COLUMN report_id;
|
|
ALTER TABLE comms.text_job DROP COLUMN creator_id;
|
|
|