feat: add explicit defaults for non-nullable columns and improve typings for nullable columns

BREAKING CHANGE: This commit replaces the initial typeorm migration.
This commit is contained in:
Xymorot 2020-08-18 00:29:49 +02:00
parent 40618ce65c
commit cc2365dc26
28 changed files with 112 additions and 76 deletions

View File

@ -15,6 +15,7 @@ export class AuthorName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -15,6 +15,7 @@ export class AuthorRoleName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -13,6 +13,7 @@ export class AuthorRole implements IIdentifiableEntity, IMultiNamedEntity, IDesc
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@ -25,6 +26,9 @@ export class AuthorRole implements IIdentifiableEntity, IMultiNamedEntity, IDesc
@ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.authorRoles)
public workAuthors!: Promise<WorkAuthor[]>;
@Column()
@Column({
nullable: false,
default: '',
})
public description!: string;
}

View File

@ -12,6 +12,7 @@ export class Author implements IIdentifiableEntity, IMultiNamedEntity {
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;

View File

@ -32,6 +32,8 @@ export class CharacterTag implements IIdentifiableEntity, IWeightedEntity {
})
public tag!: Promise<Tag>;
@Column()
public weight!: number;
@Column('int', {
nullable: true,
})
public weight!: number | null;
}

View File

@ -15,6 +15,7 @@ export class CollectionName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -15,7 +15,10 @@ export class Collection implements IIdentifiableEntity, IMultiNamedEntity {
@PrimaryGeneratedColumn()
public id!: number;
@Column()
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@OneToMany(() => CollectionName, (collectionName: CollectionName) => collectionName.entity)

View File

@ -35,16 +35,17 @@ export class Copy implements IIdentifiableEntity {
*/
@Column({
nullable: false,
default: '',
})
public hash!: string;
/**
* device location of the copy
*/
@Column({
@Column('text', {
nullable: true,
})
public location!: string;
public location!: string | null;
/**
* the ordering of the copies belonging to the same work,

View File

@ -1,5 +1,5 @@
/**
* Entities implenting this interface can be ordered.
* Entities implementing this interface can be ordered.
*/
declare interface IOrderableEntity {
/**

View File

@ -4,6 +4,7 @@
declare interface IWeightedEntity {
/**
* the weight, mathematically a number (0,1], practically between (0,Number.MAX_SAFE_INTEGER]
* the weight can also be not not defined, null in the database
*/
weight: number;
weight: number | null;
}

View File

@ -34,6 +34,8 @@ export class InteractionTag implements IIdentifiableEntity, IWeightedEntity {
@ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.interactedBy)
public objectCharacters!: Promise<WorkCharacter[]>;
@Column()
public weight!: number;
@Column('int', {
nullable: true,
})
public weight!: number | null;
}

View File

@ -15,6 +15,7 @@ export class SiteName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -12,6 +12,7 @@ export class Site implements IIdentifiableEntity, IMultiNamedEntity {
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;

View File

@ -15,6 +15,7 @@ export class Source implements IIdentifiableEntity {
*/
@Column({
nullable: false,
default: '',
})
public uri!: string;
@ -26,7 +27,7 @@ export class Source implements IIdentifiableEntity {
onDelete: 'RESTRICT',
onUpdate: 'CASCADE',
})
public site!: Promise<Site>;
public site!: Promise<Site> | null;
/**
* the copies which can be found here

View File

@ -15,6 +15,7 @@ export class TagName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -17,6 +17,7 @@ export class Tag implements IIdentifiableEntity, IMultiNamedEntity, IDescribable
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@ -49,7 +50,8 @@ export class Tag implements IIdentifiableEntity, IMultiNamedEntity, IDescribable
public children!: Promise<Tag[]>;
@Column({
nullable: true,
nullable: false,
default: '',
})
public description!: string;
}

View File

@ -15,6 +15,7 @@ export class TransformationTypeName implements IIdentifiableEntity, INameEntity
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -13,6 +13,7 @@ export class TransformationType implements IIdentifiableEntity, IMultiNamedEntit
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@ -23,7 +24,8 @@ export class TransformationType implements IIdentifiableEntity, IMultiNamedEntit
public names!: Promise<TransformationTypeName[]>;
@Column({
nullable: true,
nullable: false,
default: '',
})
public description!: string;

View File

@ -15,6 +15,7 @@ export class WorkCharacterName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -16,6 +16,7 @@ export class WorkCharacter implements IIdentifiableEntity, IMultiNamedEntity {
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;

View File

@ -15,6 +15,7 @@ export class WorkName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -32,6 +32,8 @@ export class WorkTag implements IIdentifiableEntity, IWeightedEntity {
})
public work!: Promise<Work>;
@Column()
public weight!: number;
@Column('int', {
nullable: true,
})
public weight!: number | null;
}

View File

@ -23,6 +23,7 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@ -84,18 +85,18 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
/**
* the user rating of this work
*/
@Column({
@Column('int', {
nullable: true,
})
public rating!: number;
public rating!: number | null;
/**
* the release date of the work
*/
@Column({
@Column('date', {
nullable: true,
})
public releaseDate!: Date;
public releaseDate!: Date | null;
/**
* the languages of the work (if applicable)

View File

@ -15,6 +15,7 @@ export class WorldCharacterName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -13,6 +13,7 @@ export class WorldCharacter implements IIdentifiableEntity, IMultiNamedEntity, I
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;

View File

@ -15,6 +15,7 @@ export class WorldName implements IIdentifiableEntity, INameEntity {
@Column({
nullable: false,
default: '',
})
public name!: string;
}

View File

@ -13,6 +13,7 @@ export class World implements IIdentifiableEntity, IMultiNamedEntity, IHierachic
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;

View File

@ -1,93 +1,93 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class initialMigration1596905308513 implements MigrationInterface {
name = 'initialMigration1596905308513';
export class initialMigration1597703268172 implements MigrationInterface {
name = 'initialMigration1597703268172';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "author_role" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "description" varchar NOT NULL)`
`CREATE TABLE "author_role" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''), "description" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "collection" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "collection" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "collection_part" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "order" integer NOT NULL DEFAULT (0), "collectionId" integer NOT NULL, "workId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "site" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "site" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer)`
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL DEFAULT (''), "siteId" integer)`
);
await queryRunner.query(
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL, "location" varchar, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL)`
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL DEFAULT (''), "location" text, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL)`
);
await queryRunner.query(`CREATE TABLE "language" ("code" varchar PRIMARY KEY NOT NULL)`);
await queryRunner.query(
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "transformation_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "description" varchar, "conservesTags" boolean NOT NULL DEFAULT (0))`
`CREATE TABLE "transformation_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''), "description" varchar NOT NULL DEFAULT (''), "conservesTags" boolean NOT NULL DEFAULT (0))`
);
await queryRunner.query(
`CREATE TABLE "transformation" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "order" integer NOT NULL DEFAULT (0), "byWorkId" integer NOT NULL, "typeId" integer NOT NULL, "ofWorkId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`CREATE TABLE "tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "description" varchar)`
`CREATE TABLE "tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''), "description" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "world" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "world" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "world_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "world_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "work_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "work_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "work" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "isCanonical" boolean NOT NULL DEFAULT (0), "rating" integer, "releaseDate" datetime, CONSTRAINT "rating needs to be between 0 and 9007199254740991" CHECK (rating >= 0 AND rating <= 9007199254740991))`
`CREATE TABLE "work" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''), "isCanonical" boolean NOT NULL DEFAULT (0), "rating" integer, "releaseDate" date, CONSTRAINT "rating needs to be between 0 and 9007199254740991" CHECK (rating >= 0 AND rating <= 9007199254740991))`
);
await queryRunner.query(
`CREATE TABLE "work_author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "order" integer NOT NULL DEFAULT (0), "workId" integer NOT NULL, "authorId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`
`CREATE TABLE "author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL DEFAULT (''))`
);
await queryRunner.query(
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`CREATE TABLE "copy_sources_source" ("copyId" integer NOT NULL, "sourceId" integer NOT NULL, PRIMARY KEY ("copyId", "sourceId"))`
@ -171,7 +171,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
`CREATE INDEX "IDX_1f53233757f73a30345a845b36" ON "work_author_author_roles_author_role" ("authorRoleId") `
);
await queryRunner.query(
`CREATE TABLE "temporary_author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_53007d787184883d4f88f518213" FOREIGN KEY ("entityId") REFERENCES "author_role" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_53007d787184883d4f88f518213" FOREIGN KEY ("entityId") REFERENCES "author_role" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_author_role_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "author_role_name"`
@ -179,7 +179,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "author_role_name"`);
await queryRunner.query(`ALTER TABLE "temporary_author_role_name" RENAME TO "author_role_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_e32c613ebf793bdec166b99c67c" FOREIGN KEY ("entityId") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_e32c613ebf793bdec166b99c67c" FOREIGN KEY ("entityId") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_collection_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "collection_name"`
@ -195,7 +195,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "collection_part"`);
await queryRunner.query(`ALTER TABLE "temporary_collection_part" RENAME TO "collection_part"`);
await queryRunner.query(
`CREATE TABLE "temporary_site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_320041fe1c2631a761b25d4446a" FOREIGN KEY ("entityId") REFERENCES "site" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_320041fe1c2631a761b25d4446a" FOREIGN KEY ("entityId") REFERENCES "site" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_site_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "site_name"`
@ -203,7 +203,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "site_name"`);
await queryRunner.query(`ALTER TABLE "temporary_site_name" RENAME TO "site_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer, CONSTRAINT "FK_73b253e679f350d140bdb104e49" FOREIGN KEY ("siteId") REFERENCES "site" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)`
`CREATE TABLE "temporary_source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL DEFAULT (''), "siteId" integer, CONSTRAINT "FK_73b253e679f350d140bdb104e49" FOREIGN KEY ("siteId") REFERENCES "site" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "source"`
@ -211,7 +211,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "source"`);
await queryRunner.query(`ALTER TABLE "temporary_source" RENAME TO "source"`);
await queryRunner.query(
`CREATE TABLE "temporary_copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL, "location" varchar, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL, CONSTRAINT "FK_e8ce0011cf0a8b9fdc8ad908a44" FOREIGN KEY ("originalId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL DEFAULT (''), "location" text, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL, CONSTRAINT "FK_e8ce0011cf0a8b9fdc8ad908a44" FOREIGN KEY ("originalId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_copy"("id", "hash", "location", "ranking", "originalId") SELECT "id", "hash", "location", "ranking", "originalId" FROM "copy"`
@ -219,7 +219,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "copy"`);
await queryRunner.query(`ALTER TABLE "temporary_copy" RENAME TO "copy"`);
await queryRunner.query(
`CREATE TABLE "temporary_transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_5bc54ac960e6587c39297194ec6" FOREIGN KEY ("entityId") REFERENCES "transformation_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_5bc54ac960e6587c39297194ec6" FOREIGN KEY ("entityId") REFERENCES "transformation_type" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_transformation_type_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "transformation_type_name"`
@ -235,7 +235,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "transformation"`);
await queryRunner.query(`ALTER TABLE "temporary_transformation" RENAME TO "transformation"`);
await queryRunner.query(
`CREATE TABLE "temporary_interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_af4c7e7219611f6b6025b8276f0" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_af4c7e7219611f6b6025b8276f0" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_interaction_tag"("id", "weight", "tagId") SELECT "id", "weight", "tagId" FROM "interaction_tag"`
@ -243,7 +243,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "interaction_tag"`);
await queryRunner.query(`ALTER TABLE "temporary_interaction_tag" RENAME TO "interaction_tag"`);
await queryRunner.query(
`CREATE TABLE "temporary_tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_94c570315f982d2434046c30dc1" FOREIGN KEY ("entityId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_94c570315f982d2434046c30dc1" FOREIGN KEY ("entityId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_tag_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "tag_name"`
@ -251,7 +251,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "tag_name"`);
await queryRunner.query(`ALTER TABLE "temporary_tag_name" RENAME TO "tag_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_8428f32a2c63df16b605e77326e" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_13dd6d2f7b58c451636bf28b4f8" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_8428f32a2c63df16b605e77326e" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_13dd6d2f7b58c451636bf28b4f8" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_work_tag"("id", "weight", "tagId", "workId") SELECT "id", "weight", "tagId", "workId" FROM "work_tag"`
@ -259,7 +259,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "work_tag"`);
await queryRunner.query(`ALTER TABLE "temporary_work_tag" RENAME TO "work_tag"`);
await queryRunner.query(
`CREATE TABLE "temporary_character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_0c27931804d469fba75a2c5d357" FOREIGN KEY ("workCharacterId") REFERENCES "work_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_14ffc3712f3341e793668b2cd61" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991), CONSTRAINT "FK_0c27931804d469fba75a2c5d357" FOREIGN KEY ("workCharacterId") REFERENCES "work_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_14ffc3712f3341e793668b2cd61" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_character_tag"("id", "weight", "workCharacterId", "tagId") SELECT "id", "weight", "workCharacterId", "tagId" FROM "character_tag"`
@ -267,7 +267,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "character_tag"`);
await queryRunner.query(`ALTER TABLE "temporary_character_tag" RENAME TO "character_tag"`);
await queryRunner.query(
`CREATE TABLE "temporary_work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_0f95e554fd5bd674937f733f219" FOREIGN KEY ("entityId") REFERENCES "work_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_0f95e554fd5bd674937f733f219" FOREIGN KEY ("entityId") REFERENCES "work_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_work_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "work_character_name"`
@ -275,7 +275,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "work_character_name"`);
await queryRunner.query(`ALTER TABLE "temporary_work_character_name" RENAME TO "work_character_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_1147cb1b497ecbf3b8d3c2ac1b3" FOREIGN KEY ("entityId") REFERENCES "world" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_1147cb1b497ecbf3b8d3c2ac1b3" FOREIGN KEY ("entityId") REFERENCES "world" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_world_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "world_name"`
@ -283,7 +283,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "world_name"`);
await queryRunner.query(`ALTER TABLE "temporary_world_name" RENAME TO "world_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_00fb48ee8ded5c6bc3061c83cbb" FOREIGN KEY ("entityId") REFERENCES "world_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_00fb48ee8ded5c6bc3061c83cbb" FOREIGN KEY ("entityId") REFERENCES "world_character" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_world_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "world_character_name"`
@ -291,7 +291,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "world_character_name"`);
await queryRunner.query(`ALTER TABLE "temporary_world_character_name" RENAME TO "world_character_name"`);
await queryRunner.query(
`CREATE TABLE "temporary_work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_e9887937be670e7056b2ce480d2" FOREIGN KEY ("entityId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_e9887937be670e7056b2ce480d2" FOREIGN KEY ("entityId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_work_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "work_name"`
@ -307,7 +307,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "work_author"`);
await queryRunner.query(`ALTER TABLE "temporary_work_author" RENAME TO "work_author"`);
await queryRunner.query(
`CREATE TABLE "temporary_author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL, CONSTRAINT "FK_fb4e8ac4593d1c4d5b10c013d41" FOREIGN KEY ("entityId") REFERENCES "author" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
`CREATE TABLE "temporary_author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL, CONSTRAINT "FK_fb4e8ac4593d1c4d5b10c013d41" FOREIGN KEY ("entityId") REFERENCES "author" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`
);
await queryRunner.query(
`INSERT INTO "temporary_author_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "author_name"`
@ -663,7 +663,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`CREATE INDEX "IDX_653c33c5db26b8736e592ff3f6" ON "copy_sources_source" ("copyId") `);
await queryRunner.query(`ALTER TABLE "author_name" RENAME TO "temporary_author_name"`);
await queryRunner.query(
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "author_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_author_name"`
@ -679,7 +679,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_work_author"`);
await queryRunner.query(`ALTER TABLE "work_name" RENAME TO "temporary_work_name"`);
await queryRunner.query(
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "work_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_work_name"`
@ -687,7 +687,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_work_name"`);
await queryRunner.query(`ALTER TABLE "world_character_name" RENAME TO "temporary_world_character_name"`);
await queryRunner.query(
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "world_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_world_character_name"`
@ -695,7 +695,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_world_character_name"`);
await queryRunner.query(`ALTER TABLE "world_name" RENAME TO "temporary_world_name"`);
await queryRunner.query(
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "world_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_world_name"`
@ -703,7 +703,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_world_name"`);
await queryRunner.query(`ALTER TABLE "work_character_name" RENAME TO "temporary_work_character_name"`);
await queryRunner.query(
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "work_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_work_character_name"`
@ -711,7 +711,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_work_character_name"`);
await queryRunner.query(`ALTER TABLE "character_tag" RENAME TO "temporary_character_tag"`);
await queryRunner.query(
`CREATE TABLE "character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "character_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "workCharacterId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`INSERT INTO "character_tag"("id", "weight", "workCharacterId", "tagId") SELECT "id", "weight", "workCharacterId", "tagId" FROM "temporary_character_tag"`
@ -719,7 +719,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_character_tag"`);
await queryRunner.query(`ALTER TABLE "work_tag" RENAME TO "temporary_work_tag"`);
await queryRunner.query(
`CREATE TABLE "work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "work_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`INSERT INTO "work_tag"("id", "weight", "tagId", "workId") SELECT "id", "weight", "tagId", "workId" FROM "temporary_work_tag"`
@ -727,7 +727,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_work_tag"`);
await queryRunner.query(`ALTER TABLE "tag_name" RENAME TO "temporary_tag_name"`);
await queryRunner.query(
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "tag_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_tag_name"`
@ -735,7 +735,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_tag_name"`);
await queryRunner.query(`ALTER TABLE "interaction_tag" RENAME TO "temporary_interaction_tag"`);
await queryRunner.query(
`CREATE TABLE "interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
`CREATE TABLE "interaction_tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "weight" integer, "tagId" integer NOT NULL, CONSTRAINT "weight needs to be between 0 and 9007199254740991" CHECK (weight >= 0 AND weight <= 9007199254740991))`
);
await queryRunner.query(
`INSERT INTO "interaction_tag"("id", "weight", "tagId") SELECT "id", "weight", "tagId" FROM "temporary_interaction_tag"`
@ -751,7 +751,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_transformation"`);
await queryRunner.query(`ALTER TABLE "transformation_type_name" RENAME TO "temporary_transformation_type_name"`);
await queryRunner.query(
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "transformation_type_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_transformation_type_name"`
@ -759,7 +759,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_transformation_type_name"`);
await queryRunner.query(`ALTER TABLE "copy" RENAME TO "temporary_copy"`);
await queryRunner.query(
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL, "location" varchar, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL)`
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hash" varchar NOT NULL DEFAULT (''), "location" text, "ranking" integer NOT NULL DEFAULT (0), "originalId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "copy"("id", "hash", "location", "ranking", "originalId") SELECT "id", "hash", "location", "ranking", "originalId" FROM "temporary_copy"`
@ -767,7 +767,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_copy"`);
await queryRunner.query(`ALTER TABLE "source" RENAME TO "temporary_source"`);
await queryRunner.query(
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer)`
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL DEFAULT (''), "siteId" integer)`
);
await queryRunner.query(
`INSERT INTO "source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "temporary_source"`
@ -775,7 +775,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_source"`);
await queryRunner.query(`ALTER TABLE "site_name" RENAME TO "temporary_site_name"`);
await queryRunner.query(
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "site_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_site_name"`
@ -791,7 +791,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_collection_part"`);
await queryRunner.query(`ALTER TABLE "collection_name" RENAME TO "temporary_collection_name"`);
await queryRunner.query(
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "collection_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_collection_name"`
@ -799,7 +799,7 @@ export class initialMigration1596905308513 implements MigrationInterface {
await queryRunner.query(`DROP TABLE "temporary_collection_name"`);
await queryRunner.query(`ALTER TABLE "author_role_name" RENAME TO "temporary_author_role_name"`);
await queryRunner.query(
`CREATE TABLE "author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`
`CREATE TABLE "author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL DEFAULT (''), "entityId" integer NOT NULL)`
);
await queryRunner.query(
`INSERT INTO "author_role_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_author_role_name"`