summaryrefslogtreecommitdiff
path: root/packages/backend/migration
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2025-07-15 09:20:48 +0900
committerGitHub <noreply@github.com>2025-07-15 09:20:48 +0900
commit08cc5a99bb026a9e9f308254ae814f1b9a2f620d (patch)
treecb2a7c94f29dcaf31ee0fce4fa74e5b3bb808c00 /packages/backend/migration
parentBump version to 2025.7.0-beta.1 (diff)
downloadmisskey-08cc5a99bb026a9e9f308254ae814f1b9a2f620d.tar.gz
misskey-08cc5a99bb026a9e9f308254ae814f1b9a2f620d.tar.bz2
misskey-08cc5a99bb026a9e9f308254ae814f1b9a2f620d.zip
Don't remove notes when reply / renote is removed (#16287)
* chore: make NO ACTION on channel/reply/renote removal * chore(docs): add description to show a possibility of reply null with replyId non-null * fix: packing NoteDraft fails when reply / renote is removed * feat: show drafts targeting removed renote / reply as "削除された投稿への投稿"
Diffstat (limited to 'packages/backend/migration')
-rw-r--r--packages/backend/migration/1752502434151-no-action-on-draft-relation.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/backend/migration/1752502434151-no-action-on-draft-relation.js b/packages/backend/migration/1752502434151-no-action-on-draft-relation.js
new file mode 100644
index 0000000000..e3c63b79c7
--- /dev/null
+++ b/packages/backend/migration/1752502434151-no-action-on-draft-relation.js
@@ -0,0 +1,24 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+export class NoActionOnDraftRelation1752502434151 {
+ name = 'NoActionOnDraftRelation1752502434151'
+
+ async up(queryRunner) {
+ await queryRunner.query(`ALTER TABLE "note_draft" DROP CONSTRAINT "FK_NOTE_DRAFT_CHANNEL_ID"`);
+ await queryRunner.query(`ALTER TABLE "note_draft" DROP CONSTRAINT "FK_NOTE_DRAFT_USER_ID"`);
+ await queryRunner.query(`ALTER TABLE "note_draft" DROP CONSTRAINT "FK_NOTE_DRAFT_RENOTE_ID"`);
+ await queryRunner.query(`ALTER TABLE "note_draft" DROP CONSTRAINT "FK_NOTE_DRAFT_REPLY_ID"`);
+ await queryRunner.query(`ALTER TABLE "note_draft" ADD CONSTRAINT "FK_e4983f28b4b18b03491536052f5" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ }
+
+ async down(queryRunner) {
+ await queryRunner.query(`ALTER TABLE "note_draft" DROP CONSTRAINT "FK_e4983f28b4b18b03491536052f5"`);
+ await queryRunner.query(`ALTER TABLE "note_draft" ADD CONSTRAINT "FK_NOTE_DRAFT_REPLY_ID" FOREIGN KEY ("replyId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ await queryRunner.query(`ALTER TABLE "note_draft" ADD CONSTRAINT "FK_NOTE_DRAFT_RENOTE_ID" FOREIGN KEY ("renoteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ await queryRunner.query(`ALTER TABLE "note_draft" ADD CONSTRAINT "FK_NOTE_DRAFT_USER_ID" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ await queryRunner.query(`ALTER TABLE "note_draft" ADD CONSTRAINT "FK_NOTE_DRAFT_CHANNEL_ID" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
+ }
+}