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