We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 46d4b723 authored by David L. L. Thomas's avatar David L. L. Thomas

Migration for splitting comment_closure table.

parent f8d732db
DELETE FROM comment_closure WHERE id IN (SELECT two.id FROM comment_closure AS one JOIN comment_closure AS two ON one.comment = two.comment WHERE one.type = two.type AND one.ts < two.ts);
CREATe TABLE "comment_closing"("id" SERIAL PRIMARY KEY UNIQUE,"ts" TIMESTAMP NOT NULL,"closed_by" INT8 NOT NULL,"reason" VARCHAR NOT NULL,"comment" INT8 NOT NULL);
ALTER TABLE "comment_closing" ADD CONSTRAINT "unique_comment_closing" UNIQUE("comment");
ALTER TABLE "comment_closing" ADD CONSTRAINT "comment_closing_closed_by_fkey" FOREIGN KEY("closed_by") REFERENCES "user"("id");
ALTER TABLE "comment_closing" ADD CONSTRAINT "comment_closing_comment_fkey" FOREIGN KEY("comment") REFERENCES "comment"("id");
INSERT INTO "comment_closing" (ts, closed_by, reason, comment) SELECT DISTINCT ts, closed_by, reason, comment FROM comment_closure WHERE type = 'Closed';
CREATe TABLE "a"("id" SERIAL PRIMARY KEY UNIQUE);
CREATe TABLE "comment_retracting"("id" SERIAL PRIMARY KEY UNIQUE,"ts" TIMESTAMP NOT NULL,"reason" VARCHAR NOT NULL,"comment" INT8 NOT NULL);
ALTER TABLE "comment_retracting" ADD CONSTRAINT "unique_comment_retracting" UNIQUE("comment");
ALTER TABLE "comment_retracting" ADD CONSTRAINT "comment_retracting_comment_fkey" FOREIGN KEY("comment") REFERENCES "comment"("id");
INSERT INTO "comment_retracting" (ts, reason, comment) SELECT DISTINCT ts, reason, comment FROM comment_closure WHERE type = 'Retracted';
DROP TABLE comment_closure;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment