chore (backend): tweak migration queries
This commit is contained in:
parent
3061147bd3
commit
3ceaf99df6
3 changed files with 10 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
|||
BEGIN;
|
||||
|
||||
DELETE FROM "migrations" WHERE name IN (
|
||||
'CreateScheduledNoteCreation1714728200194',
|
||||
'AlterAkaType1714099399879',
|
||||
'AddDriveFileUsage1713451569342',
|
||||
'ConvertCwVarcharToText1713225866247',
|
||||
|
@ -25,6 +26,9 @@ DELETE FROM "migrations" WHERE name IN (
|
|||
'RemoveNativeUtilsMigration1705877093218'
|
||||
);
|
||||
|
||||
-- create-scheduled-note-creation
|
||||
DROP TABLE "scheduled_note_creation";
|
||||
|
||||
-- alter-aka-type
|
||||
ALTER TABLE "user" RENAME COLUMN "alsoKnownAs" TO "alsoKnownAsOld";
|
||||
ALTER TABLE "user" ADD COLUMN "alsoKnownAs" text;
|
||||
|
|
|
@ -6,11 +6,10 @@ export class CreateScheduledNoteCreation1714728200194
|
|||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "scheduled_note_creation" (
|
||||
"id" character varying(32) NOT NULL,
|
||||
"id" character varying(32) NOT NULL PRIMARY KEY,
|
||||
"noteId" character varying(32) NOT NULL,
|
||||
"userId" character varying(32) NOT NULL,
|
||||
"scheduledAt" TIMESTAMP WITHOUT TIME ZONE NOT NULL,
|
||||
CONSTRAINT "PK_id_ScheduledNoteCreation" PRIMARY KEY ("id")
|
||||
"scheduledAt" TIMESTAMP WITHOUT TIME ZONE NOT NULL
|
||||
)`,
|
||||
);
|
||||
await queryRunner.query(`
|
||||
|
@ -24,31 +23,19 @@ export class CreateScheduledNoteCreation1714728200194
|
|||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation"
|
||||
ADD CONSTRAINT "FK_noteId_ScheduledNoteCreation"
|
||||
FOREIGN KEY ("noteId")
|
||||
REFERENCES "note"("id")
|
||||
ADD FOREIGN KEY ("noteId") REFERENCES "note"("id")
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation"
|
||||
ADD CONSTRAINT "FK_userId_ScheduledNoteCreation"
|
||||
FOREIGN KEY ("userId")
|
||||
REFERENCES "user"("id")
|
||||
ADD FOREIGN KEY ("userId") REFERENCES "user"("id")
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation" DROP CONSTRAINT "FK_noteId_ScheduledNoteCreation"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation" DROP CONSTRAINT "FK_userId_ScheduledNoteCreation"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP TABLE "scheduled_note_creation"
|
||||
`);
|
||||
await queryRunner.query(`DROP TABLE "scheduled_note_creation"`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ export const WellKnownContext = {
|
|||
manuallyApprovesFollowers: "as:manuallyApprovesFollowers",
|
||||
movedTo: {
|
||||
"@id": "https://www.w3.org/ns/activitystreams#movedTo",
|
||||
"@type": "@id"
|
||||
"@type": "@id",
|
||||
},
|
||||
movedToUri: "as:movedTo",
|
||||
sensitive: "as:sensitive",
|
||||
|
|
Loading…
Reference in a new issue