This is a pretty big refactor of how communication works to start moving us in the direction we want to go long-term. This adds the new communication row and migrates existing reports to add rows for communication. There's also a bunch of automatic fixes from the new linter. I should have added them separately, but whatever.
22 lines
863 B
SQL
22 lines
863 B
SQL
-- +goose Up
|
|
CREATE TABLE communication (
|
|
closed TIMESTAMP WITHOUT TIME ZONE,
|
|
closed_by INTEGER REFERENCES user_(id),
|
|
created TIMESTAMP WITHOUT TIME ZONE NOT NULL,
|
|
id SERIAL,
|
|
invalidated TIMESTAMP WITHOUT TIME ZONE,
|
|
invalidated_by INTEGER REFERENCES user_(id),
|
|
opened TIMESTAMP WITHOUT TIME ZONE,
|
|
opened_by INTEGER REFERENCES user_(id),
|
|
organization_id INTEGER NOT NULL REFERENCES organization(id),
|
|
response_email_log_id INTEGER REFERENCES comms.email_log(id),
|
|
response_text_log_id INTEGER REFERENCES comms.text_log(id),
|
|
set_pending TIMESTAMP WITHOUT TIME ZONE,
|
|
set_pending_by INTEGER REFERENCES user_(id),
|
|
source_email_log_id INTEGER REFERENCES comms.email_log(id),
|
|
source_report_id INTEGER REFERENCES publicreport.report(id),
|
|
source_text_log_id INTEGER REFERENCES comms.text_log(id),
|
|
PRIMARY KEY(id)
|
|
);
|
|
-- +goose Down
|
|
DROP TABLE communication;
|