update initial migration and entities
This commit is contained in:
parent
cd7aaf9ad7
commit
69147d6ecc
@ -12,10 +12,10 @@
|
||||
Migrations are stored in [src/main/migrations](src/main/migrations) and handled by typeorm.
|
||||
|
||||
To auto-generate a migration:
|
||||
`node_modules/.bin/typeorm migration:generate -c <connection name>`
|
||||
`node_modules/.bin/typeorm migration:generate -n <migration name> -c <connection name>`
|
||||
|
||||
To create an empty creation which can be filled with custom migration code:
|
||||
`node_modules/.bin/typeorm migration:create -c <connection name>`
|
||||
`node_modules/.bin/typeorm migration:create -n <migration name> -c <connection name>`
|
||||
|
||||
To run migrations:
|
||||
`node_modules/.bin/typeorm migration:run -c <connection name>`
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Entity, JoinTable, ManyToMany, OneToMany } from 'typeorm';
|
||||
import { Author } from './author';
|
||||
import { MultiNamed } from './bases/multiNamed';
|
||||
import { Character } from './character';
|
||||
import { Copy } from './copy';
|
||||
import { IntellectualProperty } from './intellectualProperty';
|
||||
import { Fiction } from './fiction';
|
||||
import { Tag } from './tag';
|
||||
|
||||
@Entity()
|
||||
export class Book extends MultiNamed {
|
||||
@OneToMany(() => Copy, copy => copy.original, {
|
||||
nullable: true,
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@ -22,13 +23,21 @@ export class Book extends MultiNamed {
|
||||
@JoinTable()
|
||||
public authors: Promise<Author[]>;
|
||||
|
||||
@ManyToMany(() => IntellectualProperty, {
|
||||
@ManyToMany(() => Fiction, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public intellectualProperties: Promise<IntellectualProperty[]>;
|
||||
public fictions: Promise<Fiction[]>;
|
||||
|
||||
@ManyToMany(() => Character, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public characters: Promise<Character[]>;
|
||||
|
||||
@ManyToMany(() => Tag, {
|
||||
nullable: true,
|
||||
|
@ -1,13 +1,21 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { MultiNamed } from './bases/multiNamed';
|
||||
import { Book } from './book';
|
||||
import { Fiction } from './fiction';
|
||||
|
||||
@Entity()
|
||||
export class IntellectualProperty extends MultiNamed {
|
||||
export class Character extends MultiNamed {
|
||||
@ManyToMany(() => Book, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
|
||||
@ManyToMany(() => Fiction, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public fictions: Promise<Fiction[]>;
|
||||
}
|
@ -23,12 +23,16 @@ export class Copy extends Base {
|
||||
public original: Promise<Book>;
|
||||
|
||||
@Column({ nullable: false, default: false })
|
||||
public favorites: boolean;
|
||||
public favorited: boolean;
|
||||
|
||||
@OneToMany(() => CopyType, copyType => copyType.copy)
|
||||
@OneToMany(() => CopyType, copyType => copyType.copy, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public types: Promise<CopyType[]>;
|
||||
|
||||
@Column({ nullable: true })
|
||||
@Column({ nullable: false })
|
||||
public isDigital: boolean;
|
||||
|
||||
@ManyToMany(() => Source, {
|
||||
|
@ -3,10 +3,10 @@ import { Base } from './bases/base';
|
||||
import { Copy } from './copy';
|
||||
|
||||
const enum CopyTypes {
|
||||
ORIGINAL,
|
||||
TRANSLATED,
|
||||
UNCENSORED,
|
||||
OTHER,
|
||||
ORIGINAL = 'original',
|
||||
TRANSLATED = 'translated',
|
||||
UNCENSORED = 'uncensored',
|
||||
OTHER = 'other',
|
||||
}
|
||||
|
||||
@Entity()
|
||||
|
21
src/main/entities/fiction.ts
Normal file
21
src/main/entities/fiction.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { MultiNamed } from './bases/multiNamed';
|
||||
import { Book } from './book';
|
||||
import { Character } from './character';
|
||||
|
||||
@Entity()
|
||||
export class Fiction extends MultiNamed {
|
||||
@ManyToMany(() => Book, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
|
||||
@ManyToMany(() => Character, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public characters: Promise<Character[]>;
|
||||
}
|
@ -1,10 +1,16 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
// tslint:disable-next-line: class-name
|
||||
export class initialMigration1561252345968 implements MigrationInterface {
|
||||
export class initialMigration1561296682728 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" integer NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`
|
||||
`CREATE TABLE "fiction" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "language" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "code" varchar NOT NULL, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))`
|
||||
@ -19,10 +25,7 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
`CREATE TABLE "translator" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorites" boolean NOT NULL DEFAULT (0), "isDigital" boolean, "originalId" integer NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "intellectual_property" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
@ -33,6 +36,9 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "intellectual_property" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "names" text NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_sources_source" ("copyId" integer NOT NULL, "sourceId" integer NOT NULL, PRIMARY KEY ("copyId", "sourceId"))`
|
||||
);
|
||||
@ -70,13 +76,22 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
`CREATE INDEX "IDX_a4cafdf2ec9974524a5321c751" ON "book_authors_author" ("authorId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_intellectual_properties_intellectual_property" ("bookId" integer NOT NULL, "intellectualPropertyId" integer NOT NULL, PRIMARY KEY ("bookId", "intellectualPropertyId"))`
|
||||
`CREATE TABLE "book_fictions_fiction" ("bookId" integer NOT NULL, "fictionId" integer NOT NULL, PRIMARY KEY ("bookId", "fictionId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e9c020c583e45df7d34114e894" ON "book_intellectual_properties_intellectual_property" ("bookId") `
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_fe535d19fd50189cbeda0f92fd" ON "book_intellectual_properties_intellectual_property" ("intellectualPropertyId") `
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_characters_character" ("bookId" integer NOT NULL, "characterId" integer NOT NULL, PRIMARY KEY ("bookId", "characterId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_tags_tag" ("bookId" integer NOT NULL, "tagId" integer NOT NULL, PRIMARY KEY ("bookId", "tagId"))`
|
||||
@ -88,7 +103,7 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
`CREATE INDEX "IDX_5274aca0a1468ed55afdfaba24" ON "book_tags_tag" ("tagId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" integer NOT NULL, "comment" varchar, "copyId" integer NOT NULL, CONSTRAINT "FK_156b15213d57b5dbbbc33e94050" FOREIGN KEY ("copyId") REFERENCES "copy" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
|
||||
`CREATE TABLE "temporary_copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar NOT NULL, "comment" varchar, "copyId" integer NOT NULL, CONSTRAINT "FK_156b15213d57b5dbbbc33e94050" FOREIGN KEY ("copyId") REFERENCES "copy" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy_type"("id", "type", "comment", "copyId") SELECT "id", "type", "comment", "copyId" FROM "copy_type"`
|
||||
@ -108,10 +123,10 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
`ALTER TABLE "temporary_source" RENAME TO "source"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorites" boolean NOT NULL DEFAULT (0), "isDigital" boolean, "originalId" integer NOT NULL, CONSTRAINT "FK_e8ce0011cf0a8b9fdc8ad908a44" FOREIGN KEY ("originalId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
|
||||
`CREATE TABLE "temporary_copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL, CONSTRAINT "FK_e8ce0011cf0a8b9fdc8ad908a44" FOREIGN KEY ("originalId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy"("id", "favorites", "isDigital", "originalId") SELECT "id", "favorites", "isDigital", "originalId" FROM "copy"`
|
||||
`INSERT INTO "temporary_copy"("id", "favorited", "isDigital", "originalId") SELECT "id", "favorited", "isDigital", "originalId" FROM "copy"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy"`);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_copy" RENAME TO "copy"`);
|
||||
@ -187,25 +202,41 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a4cafdf2ec9974524a5321c751" ON "book_authors_author" ("authorId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e9c020c583e45df7d34114e894"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fe535d19fd50189cbeda0f92fd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book_intellectual_properties_intellectual_property" ("bookId" integer NOT NULL, "intellectualPropertyId" integer NOT NULL, CONSTRAINT "FK_e9c020c583e45df7d34114e8945" FOREIGN KEY ("bookId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_fe535d19fd50189cbeda0f92fda" FOREIGN KEY ("intellectualPropertyId") REFERENCES "intellectual_property" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("bookId", "intellectualPropertyId"))`
|
||||
`CREATE TABLE "temporary_book_fictions_fiction" ("bookId" integer NOT NULL, "fictionId" integer NOT NULL, CONSTRAINT "FK_893dfbd84bd3a5a62e8a0758b3f" FOREIGN KEY ("bookId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_842bd3a8cb49dc7a92058b7f7aa" FOREIGN KEY ("fictionId") REFERENCES "fiction" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("bookId", "fictionId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_intellectual_properties_intellectual_property"("bookId", "intellectualPropertyId") SELECT "bookId", "intellectualPropertyId" FROM "book_intellectual_properties_intellectual_property"`
|
||||
`INSERT INTO "temporary_book_fictions_fiction"("bookId", "fictionId") SELECT "bookId", "fictionId" FROM "book_fictions_fiction"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_fictions_fiction"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_book_fictions_fiction" RENAME TO "book_fictions_fiction"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TABLE "book_intellectual_properties_intellectual_property"`
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_book_intellectual_properties_intellectual_property" RENAME TO "book_intellectual_properties_intellectual_property"`
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book_characters_character" ("bookId" integer NOT NULL, "characterId" integer NOT NULL, CONSTRAINT "FK_261dcea7cb50a485906440f91f8" FOREIGN KEY ("bookId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_51615a52cc3ef773766afbcc433" FOREIGN KEY ("characterId") REFERENCES "character" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("bookId", "characterId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e9c020c583e45df7d34114e894" ON "book_intellectual_properties_intellectual_property" ("bookId") `
|
||||
`INSERT INTO "temporary_book_characters_character"("bookId", "characterId") SELECT "bookId", "characterId" FROM "book_characters_character"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_characters_character"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_book_characters_character" RENAME TO "book_characters_character"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_fe535d19fd50189cbeda0f92fd" ON "book_intellectual_properties_intellectual_property" ("intellectualPropertyId") `
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_918a7b7552fe5fd66f328d4fe8"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5274aca0a1468ed55afdfaba24"`);
|
||||
@ -246,25 +277,41 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_918a7b7552fe5fd66f328d4fe8" ON "book_tags_tag" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fe535d19fd50189cbeda0f92fd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e9c020c583e45df7d34114e894"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "book_intellectual_properties_intellectual_property" RENAME TO "temporary_book_intellectual_properties_intellectual_property"`
|
||||
`ALTER TABLE "book_characters_character" RENAME TO "temporary_book_characters_character"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_intellectual_properties_intellectual_property" ("bookId" integer NOT NULL, "intellectualPropertyId" integer NOT NULL, PRIMARY KEY ("bookId", "intellectualPropertyId"))`
|
||||
`CREATE TABLE "book_characters_character" ("bookId" integer NOT NULL, "characterId" integer NOT NULL, PRIMARY KEY ("bookId", "characterId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_intellectual_properties_intellectual_property"("bookId", "intellectualPropertyId") SELECT "bookId", "intellectualPropertyId" FROM "temporary_book_intellectual_properties_intellectual_property"`
|
||||
`INSERT INTO "book_characters_character"("bookId", "characterId") SELECT "bookId", "characterId" FROM "temporary_book_characters_character"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_characters_character"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TABLE "temporary_book_intellectual_properties_intellectual_property"`
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "book_fictions_fiction" RENAME TO "temporary_book_fictions_fiction"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_fe535d19fd50189cbeda0f92fd" ON "book_intellectual_properties_intellectual_property" ("intellectualPropertyId") `
|
||||
`CREATE TABLE "book_fictions_fiction" ("bookId" integer NOT NULL, "fictionId" integer NOT NULL, PRIMARY KEY ("bookId", "fictionId"))`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e9c020c583e45df7d34114e894" ON "book_intellectual_properties_intellectual_property" ("bookId") `
|
||||
`INSERT INTO "book_fictions_fiction"("bookId", "fictionId") SELECT "bookId", "fictionId" FROM "temporary_book_fictions_fiction"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_fictions_fiction"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a4cafdf2ec9974524a5321c751"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9bf58ffb2a12a8609a738ee8ca"`);
|
||||
@ -342,10 +389,10 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "copy" RENAME TO "temporary_copy"`);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorites" boolean NOT NULL DEFAULT (0), "isDigital" boolean, "originalId" integer NOT NULL)`
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy"("id", "favorites", "isDigital", "originalId") SELECT "id", "favorites", "isDigital", "originalId" FROM "temporary_copy"`
|
||||
`INSERT INTO "copy"("id", "favorited", "isDigital", "originalId") SELECT "id", "favorited", "isDigital", "originalId" FROM "temporary_copy"`
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy"`);
|
||||
await queryRunner.query(
|
||||
@ -362,7 +409,7 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
`ALTER TABLE "copy_type" RENAME TO "temporary_copy_type"`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" integer NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy_type"("id", "type", "comment", "copyId") SELECT "id", "type", "comment", "copyId" FROM "temporary_copy_type"`
|
||||
@ -371,11 +418,12 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
await queryRunner.query(`DROP INDEX "IDX_5274aca0a1468ed55afdfaba24"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_918a7b7552fe5fd66f328d4fe8"`);
|
||||
await queryRunner.query(`DROP TABLE "book_tags_tag"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fe535d19fd50189cbeda0f92fd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e9c020c583e45df7d34114e894"`);
|
||||
await queryRunner.query(
|
||||
`DROP TABLE "book_intellectual_properties_intellectual_property"`
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`);
|
||||
await queryRunner.query(`DROP TABLE "book_characters_character"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`);
|
||||
await queryRunner.query(`DROP TABLE "book_fictions_fiction"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a4cafdf2ec9974524a5321c751"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9bf58ffb2a12a8609a738ee8ca"`);
|
||||
await queryRunner.query(`DROP TABLE "book_authors_author"`);
|
||||
@ -388,15 +436,17 @@ export class initialMigration1561252345968 implements MigrationInterface {
|
||||
await queryRunner.query(`DROP INDEX "IDX_946af3644f779b7cc7e7eb04eb"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_653c33c5db26b8736e592ff3f6"`);
|
||||
await queryRunner.query(`DROP TABLE "copy_sources_source"`);
|
||||
await queryRunner.query(`DROP TABLE "intellectual_property"`);
|
||||
await queryRunner.query(`DROP TABLE "author"`);
|
||||
await queryRunner.query(`DROP TABLE "book"`);
|
||||
await queryRunner.query(`DROP TABLE "tag"`);
|
||||
await queryRunner.query(`DROP TABLE "intellectual_property"`);
|
||||
await queryRunner.query(`DROP TABLE "copy"`);
|
||||
await queryRunner.query(`DROP TABLE "translator"`);
|
||||
await queryRunner.query(`DROP TABLE "source"`);
|
||||
await queryRunner.query(`DROP TABLE "site"`);
|
||||
await queryRunner.query(`DROP TABLE "language"`);
|
||||
await queryRunner.query(`DROP TABLE "copy_type"`);
|
||||
await queryRunner.query(`DROP TABLE "character"`);
|
||||
await queryRunner.query(`DROP TABLE "fiction"`);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user