fix: add missing JoinTable statement
BREAKING CHANGE: This commit replaces the initial typeorm migration.
This commit is contained in:
parent
cc2365dc26
commit
2179e0e06c
|
@ -64,6 +64,7 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
|
||||||
* characters in this work
|
* characters in this work
|
||||||
*/
|
*/
|
||||||
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.works)
|
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.works)
|
||||||
|
@JoinTable()
|
||||||
public workCharacters!: Promise<WorkCharacter[]>;
|
public workCharacters!: Promise<WorkCharacter[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
export class initialMigration1597703268172 implements MigrationInterface {
|
export class initialMigration1597705000730 implements MigrationInterface {
|
||||||
name = 'initialMigration1597703268172';
|
name = 'initialMigration1597705000730';
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -149,6 +149,15 @@ export class initialMigration1597703268172 implements MigrationInterface {
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX "IDX_a08cc5365ab334c6e7069956e4" ON "work_character_world_characters_world_character" ("worldCharacterId") `
|
`CREATE INDEX "IDX_a08cc5365ab334c6e7069956e4" ON "work_character_world_characters_world_character" ("worldCharacterId") `
|
||||||
);
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TABLE "work_work_characters_work_character" ("workId" integer NOT NULL, "workCharacterId" integer NOT NULL, PRIMARY KEY ("workId", "workCharacterId"))`
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_20407f9e6a1233ba7b259e0b5d" ON "work_work_characters_work_character" ("workId") `
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_a5d9f2079722eae5a50d10d7df" ON "work_work_characters_work_character" ("workCharacterId") `
|
||||||
|
);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE TABLE "work_worlds_world" ("workId" integer NOT NULL, "worldId" integer NOT NULL, PRIMARY KEY ("workId", "worldId"))`
|
`CREATE TABLE "work_worlds_world" ("workId" integer NOT NULL, "worldId" integer NOT NULL, PRIMARY KEY ("workId", "worldId"))`
|
||||||
);
|
);
|
||||||
|
@ -440,6 +449,24 @@ export class initialMigration1597703268172 implements MigrationInterface {
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`CREATE INDEX "IDX_a08cc5365ab334c6e7069956e4" ON "work_character_world_characters_world_character" ("worldCharacterId") `
|
`CREATE INDEX "IDX_a08cc5365ab334c6e7069956e4" ON "work_character_world_characters_world_character" ("worldCharacterId") `
|
||||||
);
|
);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_20407f9e6a1233ba7b259e0b5d"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_a5d9f2079722eae5a50d10d7df"`);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TABLE "temporary_work_work_characters_work_character" ("workId" integer NOT NULL, "workCharacterId" integer NOT NULL, CONSTRAINT "FK_20407f9e6a1233ba7b259e0b5da" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a5d9f2079722eae5a50d10d7dfd" FOREIGN KEY ("workCharacterId") REFERENCES "work_character" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("workId", "workCharacterId"))`
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`INSERT INTO "temporary_work_work_characters_work_character"("workId", "workCharacterId") SELECT "workId", "workCharacterId" FROM "work_work_characters_work_character"`
|
||||||
|
);
|
||||||
|
await queryRunner.query(`DROP TABLE "work_work_characters_work_character"`);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "temporary_work_work_characters_work_character" RENAME TO "work_work_characters_work_character"`
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_20407f9e6a1233ba7b259e0b5d" ON "work_work_characters_work_character" ("workId") `
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_a5d9f2079722eae5a50d10d7df" ON "work_work_characters_work_character" ("workCharacterId") `
|
||||||
|
);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_4406a0c9878a37f1ad0925c8cb"`);
|
await queryRunner.query(`DROP INDEX "IDX_4406a0c9878a37f1ad0925c8cb"`);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_2d04b8685d3b47ce211bc3dc64"`);
|
await queryRunner.query(`DROP INDEX "IDX_2d04b8685d3b47ce211bc3dc64"`);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -535,6 +562,24 @@ export class initialMigration1597703268172 implements MigrationInterface {
|
||||||
await queryRunner.query(`DROP TABLE "temporary_work_worlds_world"`);
|
await queryRunner.query(`DROP TABLE "temporary_work_worlds_world"`);
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_2d04b8685d3b47ce211bc3dc64" ON "work_worlds_world" ("worldId") `);
|
await queryRunner.query(`CREATE INDEX "IDX_2d04b8685d3b47ce211bc3dc64" ON "work_worlds_world" ("worldId") `);
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_4406a0c9878a37f1ad0925c8cb" ON "work_worlds_world" ("workId") `);
|
await queryRunner.query(`CREATE INDEX "IDX_4406a0c9878a37f1ad0925c8cb" ON "work_worlds_world" ("workId") `);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_a5d9f2079722eae5a50d10d7df"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_20407f9e6a1233ba7b259e0b5d"`);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "work_work_characters_work_character" RENAME TO "temporary_work_work_characters_work_character"`
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TABLE "work_work_characters_work_character" ("workId" integer NOT NULL, "workCharacterId" integer NOT NULL, PRIMARY KEY ("workId", "workCharacterId"))`
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`INSERT INTO "work_work_characters_work_character"("workId", "workCharacterId") SELECT "workId", "workCharacterId" FROM "temporary_work_work_characters_work_character"`
|
||||||
|
);
|
||||||
|
await queryRunner.query(`DROP TABLE "temporary_work_work_characters_work_character"`);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_a5d9f2079722eae5a50d10d7df" ON "work_work_characters_work_character" ("workCharacterId") `
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE INDEX "IDX_20407f9e6a1233ba7b259e0b5d" ON "work_work_characters_work_character" ("workId") `
|
||||||
|
);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_a08cc5365ab334c6e7069956e4"`);
|
await queryRunner.query(`DROP INDEX "IDX_a08cc5365ab334c6e7069956e4"`);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_1664b7580fcb1d7abb64f6e966"`);
|
await queryRunner.query(`DROP INDEX "IDX_1664b7580fcb1d7abb64f6e966"`);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
@ -814,6 +859,9 @@ export class initialMigration1597703268172 implements MigrationInterface {
|
||||||
await queryRunner.query(`DROP INDEX "IDX_2d04b8685d3b47ce211bc3dc64"`);
|
await queryRunner.query(`DROP INDEX "IDX_2d04b8685d3b47ce211bc3dc64"`);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_4406a0c9878a37f1ad0925c8cb"`);
|
await queryRunner.query(`DROP INDEX "IDX_4406a0c9878a37f1ad0925c8cb"`);
|
||||||
await queryRunner.query(`DROP TABLE "work_worlds_world"`);
|
await queryRunner.query(`DROP TABLE "work_worlds_world"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_a5d9f2079722eae5a50d10d7df"`);
|
||||||
|
await queryRunner.query(`DROP INDEX "IDX_20407f9e6a1233ba7b259e0b5d"`);
|
||||||
|
await queryRunner.query(`DROP TABLE "work_work_characters_work_character"`);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_a08cc5365ab334c6e7069956e4"`);
|
await queryRunner.query(`DROP INDEX "IDX_a08cc5365ab334c6e7069956e4"`);
|
||||||
await queryRunner.query(`DROP INDEX "IDX_1664b7580fcb1d7abb64f6e966"`);
|
await queryRunner.query(`DROP INDEX "IDX_1664b7580fcb1d7abb64f6e966"`);
|
||||||
await queryRunner.query(`DROP TABLE "work_character_world_characters_world_character"`);
|
await queryRunner.query(`DROP TABLE "work_character_world_characters_world_character"`);
|
Loading…
Reference in New Issue