chore (backend): ScheduledNoteCreation -> ScheduledNote
This commit is contained in:
parent
ec152499bf
commit
ba7fa4393a
5 changed files with 17 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
BEGIN;
|
||||
|
||||
DELETE FROM "migrations" WHERE name IN (
|
||||
'CreateScheduledNoteCreation1714728200194',
|
||||
'CreateScheduledNote1714728200194',
|
||||
'AddBackTimezone1715351290096',
|
||||
'UserprofileJsonbToArray1714270605574',
|
||||
'DropUnusedUserprofileColumns1714259023878',
|
||||
|
@ -32,8 +32,8 @@ DELETE FROM "migrations" WHERE name IN (
|
|||
'RemoveNativeUtilsMigration1705877093218'
|
||||
);
|
||||
|
||||
-- create-scheduled-note-creation
|
||||
DROP TABLE "scheduled_note_creation";
|
||||
-- create-scheduled-note
|
||||
DROP TABLE "scheduled_note";
|
||||
|
||||
-- userprofile-jsonb-to-array
|
||||
ALTER TABLE "user_profile" RENAME COLUMN "mutedInstances" TO "mutedInstances_old";
|
||||
|
|
|
@ -74,10 +74,10 @@ import { Webhook } from "@/models/entities/webhook.js";
|
|||
import { UserIp } from "@/models/entities/user-ip.js";
|
||||
import { NoteEdit } from "@/models/entities/note-edit.js";
|
||||
import { NoteFile } from "@/models/entities/note-file.js";
|
||||
import { ScheduledNote } from "@/models/entities/scheduled-note.js";
|
||||
|
||||
import { entities as charts } from "@/services/chart/entities.js";
|
||||
import { dbLogger } from "./logger.js";
|
||||
import { ScheduledNoteCreation } from "@/models/entities/scheduled-note-creation.js";
|
||||
|
||||
const sqlLogger = dbLogger.createSubLogger("sql", "gray", false);
|
||||
|
||||
|
@ -183,7 +183,7 @@ export const entities = [
|
|||
UserPending,
|
||||
Webhook,
|
||||
UserIp,
|
||||
ScheduledNoteCreation,
|
||||
ScheduledNote,
|
||||
...charts,
|
||||
];
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class CreateScheduledNoteCreation1714728200194
|
||||
export class CreateScheduledNote1714728200194
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "scheduled_note_creation" (
|
||||
`CREATE TABLE "scheduled_note" (
|
||||
"id" character varying(32) NOT NULL PRIMARY KEY,
|
||||
"noteId" character varying(32) NOT NULL,
|
||||
"userId" character varying(32) NOT NULL,
|
||||
|
@ -13,22 +13,22 @@ export class CreateScheduledNoteCreation1714728200194
|
|||
)`,
|
||||
);
|
||||
await queryRunner.query(`
|
||||
COMMENT ON COLUMN "scheduled_note_creation"."noteId" IS 'The ID of note scheduled.'
|
||||
COMMENT ON COLUMN "scheduled_note"."noteId" IS 'The ID of the temporarily created note that corresponds to the schedule.'
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE INDEX "IDX_noteId_ScheduledNoteCreation" ON "scheduled_note_creation" ("noteId")
|
||||
CREATE INDEX "IDX_noteId_ScheduledNote" ON "scheduled_note" ("noteId")
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE INDEX "IDX_userId_ScheduledNoteCreation" ON "scheduled_note_creation" ("userId")
|
||||
CREATE INDEX "IDX_userId_ScheduledNote" ON "scheduled_note" ("userId")
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation"
|
||||
ALTER TABLE "scheduled_note"
|
||||
ADD FOREIGN KEY ("noteId") REFERENCES "note"("id")
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "scheduled_note_creation"
|
||||
ALTER TABLE "scheduled_note"
|
||||
ADD FOREIGN KEY ("userId") REFERENCES "user"("id")
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE NO ACTION
|
||||
|
@ -36,6 +36,6 @@ export class CreateScheduledNoteCreation1714728200194
|
|||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE "scheduled_note_creation"`);
|
||||
await queryRunner.query(`DROP TABLE "scheduled_note"`);
|
||||
}
|
||||
}
|
|
@ -13,14 +13,14 @@ import { id } from "../id.js";
|
|||
import { User } from "./user.js";
|
||||
|
||||
@Entity()
|
||||
export class ScheduledNoteCreation {
|
||||
export class ScheduledNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: "The ID of note scheduled.",
|
||||
comment: "The ID of the temporarily created note that corresponds to the schedule.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
|
@ -67,7 +67,7 @@ import { Webhook } from "./entities/webhook.js";
|
|||
import { UserIp } from "./entities/user-ip.js";
|
||||
import { NoteFileRepository } from "./repositories/note-file.js";
|
||||
import { NoteEditRepository } from "./repositories/note-edit.js";
|
||||
import { ScheduledNoteCreation } from "./entities/scheduled-note-creation.js";
|
||||
import { ScheduledNote } from "./entities/scheduled-note.js";
|
||||
|
||||
export const Announcements = db.getRepository(Announcement);
|
||||
export const AnnouncementReads = db.getRepository(AnnouncementRead);
|
||||
|
@ -136,4 +136,4 @@ export const RegistryItems = db.getRepository(RegistryItem);
|
|||
export const Webhooks = db.getRepository(Webhook);
|
||||
export const Ads = db.getRepository(Ad);
|
||||
export const PasswordResetRequests = db.getRepository(PasswordResetRequest);
|
||||
export const ScheduledNoteCreations = db.getRepository(ScheduledNoteCreation);
|
||||
export const ScheduledNotes = db.getRepository(ScheduledNote);
|
||||
|
|
Loading…
Reference in a new issue