Skip to content

Instantly share code, notes, and snippets.

@ltlapy
Last active October 5, 2024 19:38
Show Gist options
  • Save ltlapy/f7219bc87b019de0682ff58a6c985090 to your computer and use it in GitHub Desktop.
Save ltlapy/f7219bc87b019de0682ff58a6c985090 to your computer and use it in GitHub Desktop.
misskey dropped notification table during migration, and rollback of the table is not implemented
-- from init
CREATE TABLE "notification" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "notifieeId" character varying(32) NOT NULL, "notifierId" character varying(32) NOT NULL, "type" character varying(32) NOT NULL, "isRead" boolean NOT NULL DEFAULT false, "noteId" character varying(32), "reaction" character varying(128), "choice" integer, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"));
CREATE INDEX "IDX_b11a5e627c41d4dc3170f1d370" ON "notification" ("createdAt") ;
CREATE INDEX "IDX_3c601b70a1066d2c8b517094cb" ON "notification" ("notifieeId") ;
ALTER TABLE "notification" ADD CONSTRAINT "FK_3c601b70a1066d2c8b517094cb9" FOREIGN KEY ("notifieeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "notification" ADD CONSTRAINT "FK_769cb6b73a1efe22ddf733ac453" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
-- from v1241579544426412
ALTER TABLE "notification" ADD "followRequestId" character varying(32);
ALTER TABLE "notification" ADD CONSTRAINT "FK_bd7fab507621e635b32cd31892c" FOREIGN KEY ("followRequestId") REFERENCES "follow_request"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
-- from v12101580276619901
ALTER TABLE "notification" DROP COLUMN "type";
--CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted');
ALTER TABLE "notification" ADD "type" "notification_type_enum" NOT NULL;
-- from userGroupInvitation1581526429287
ALTER TABLE "notification" ADD "userGroupInvitationId" character varying(32);
ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum";
COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.';
ALTER TABLE "notification" ADD CONSTRAINT "FK_8fe87814e978053a53b1beb7e98" FOREIGN KEY ("userGroupInvitationId") REFERENCES "user_group_invitation"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
-- from customNotification1585385921215
ALTER TABLE "notification" ADD "customBody" character varying(2048);
ALTER TABLE "notification" ADD "customHeader" character varying(256);
ALTER TABLE "notification" ADD "customIcon" character varying(1024);
ALTER TABLE "notification" ADD "appAccessTokenId" character varying(32);
ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710";
ALTER TABLE "notification" ALTER COLUMN "notifierId" DROP NOT NULL;
COMMENT ON COLUMN "notification"."notifierId" IS 'The ID of sender user of the Notification.';
ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old";
CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app');
ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum";
DROP TYPE "notification_type_enum_old";
COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.';
CREATE INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71" ON "notification" ("notifierId");
CREATE INDEX "IDX_33f33cc8ef29d805a97ff4628b" ON "notification" ("type");
CREATE INDEX "IDX_080ab397c379af09b9d2169e5b" ON "notification" ("isRead");
CREATE INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c" ON "notification" ("appAccessTokenId");
ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "notification" ADD CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9" FOREIGN KEY ("appAccessTokenId") REFERENCES "access_token"("id") ON DELETE CASCADE ON UPDATE NO ACTION;
-- from comments1605408971051
COMMENT ON COLUMN "notification"."createdAt" IS 'The created date of the Notification.';
COMMENT ON COLUMN "notification"."notifieeId" IS 'The ID of recipient user of the Notification.';
COMMENT ON COLUMN "notification"."isRead" IS 'Whether the Notification is read.';
-- from pollEndedNotification1646549089451
ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old";
CREATE TYPE "public"."notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app');
ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum" USING "type"::"text"::"public"."notification_type_enum";
DROP TYPE "public"."notification_type_enum_old";
-- from achievement1674118260469
ALTER TABLE "notification" ADD "achievement" character varying(128);
ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old";
CREATE TYPE "public"."notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'achievementEarned', 'app');
ALTER TABLE "notification" ALTER COLUMN "type" TYPE "public"."notification_type_enum" USING "type"::"text"::"public"."notification_type_enum";
DROP TYPE "public"."notification_type_enum_old";
ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" RENAME TO "user_profile_mutingnotificationtypes_enum_old";
CREATE TYPE "public"."user_profile_mutingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'achievementEarned', 'app');
ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" DROP DEFAULT;
ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" TYPE "public"."user_profile_mutingnotificationtypes_enum"[] USING "mutingNotificationTypes"::"text"::"public"."user_profile_mutingnotificationtypes_enum"[];
ALTER TABLE "user_profile" ALTER COLUMN "mutingNotificationTypes" SET DEFAULT '{}';
DROP TYPE "public"."user_profile_mutingnotificationtypes_enum_old";
-- from dropGroup1676434944993
ALTER TABLE "notification" DROP CONSTRAINT "FK_8fe87814e978053a53b1beb7e98";
ALTER TABLE "notification" DROP COLUMN "userGroupInvitationId";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment