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

Commit cbf3efc2 authored by David L. L. Thomas's avatar David L. L. Thomas

straightening out migrations for live deployment

parent a95aafd0
DROP TABLE "message" CASCADE;
ALTER TABLE "user" RENAME COLUMN "read_messages" TO "read_notifications";
CREATe TABLE "user_notification_pref"("id" SERIAL PRIMARY KEY UNIQUE,"user" INT8 NOT NULL,"type" VARCHAR NOT NULL,"delivery" VARCHAR NOT NULL);
ALTER TABLE "user_notification_pref" ADD CONSTRAINT "unique_user_notification_pref" UNIQUE("user","type");
......
ALTER TABLE "comment" DROP CONSTRAINT "comment_moderated_by_fkey";
ALTER TABLE "comment" DROP CONSTRAINT "comment_moderated_user_fkey";
ALTER TABLE "comment" RENAME COLUMN "moderated_ts" TO "approved_ts";
ALTER TABLE "comment" RENAME COLUMN "moderated_by" TO "approved_by";
ALTER TABLE "comment" ADD CONSTRAINT "comment_approved_by_fkey" FOREIGN KEY("approved_by") REFERENCES "user"("id");
\ No newline at end of file
ALTER TABLE "comment" ADD CONSTRAINT "comment_approved_by_fkey" FOREIGN KEY("approved_by") REFERENCES "user"("id");
insert into account (id, balance) values (-1, 0);
insert into discussion (id, nothing) values (-1, 0);
insert into "user" (id, ident, name, account, discussion) values (-1, 'anonymous', 'anonymous user', -1, -1);
INSERT INTO account (id, balance) VALUES (-1, 0);
INSERT INTO discussion (id, nothing) VALUES (-1, 0);
INSERT INTO "user" (id, ident, name, account, discussion, established) VALUES (-1, 'anonymous', 'anonymous user', -1, -1, 'EstEligable');
UPDATE "message" SET "from" = -1 WHERE "from" IS NULL;
INSERT INTO "comment" (created_ts, discussion, "user", text, depth) SELECT message.created_ts, project.discussion, message."from", content, 0 FROM message JOIN project ON message.project = project.id;
DROP TABLE "message" CASCADE;
ALTER TABLE "comment" ADD COLUMN "visibility" VARCHAR NOT NULL DEFAULT 'VisPublic';
ALTER TABLE "rethread" ADD COLUMN "new_comment" INT8 NOT NULL;
ALTER TABLE "rethread" ADD COLUMN "new_comment" INT8;
UPDATE "rethread" SET "new_comment" = "comment_rethread"."new_comment" FROM "comment_rethread" WHERE "comment_rethread"."rethread" = "rethread"."id" AND "comment_rethread"."old_comment" = "rethread"."old_comment";
ALTER TABLE "rethread" ALTER COLUMN "new_comment" SET NOT NULL;
ALTER TABLE "rethread" ADD CONSTRAINT "rethread_new_comment_fkey" FOREIGN KEY("new_comment") REFERENCES "comment"("id");
CREATe TABLE "event_comment_rethreaded"("id" SERIAL PRIMARY KEY UNIQUE,"ts" TIMESTAMP NOT NULL,"rethread" INT8 NOT NULL);
ALTER TABLE "event_comment_rethreaded" ADD CONSTRAINT "event_comment_rethreaded_rethread_fkey" FOREIGN KEY("rethread") REFERENCES "rethread"("id");
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