feat: update typeorm entities and reset database migrations
BREAKING CHANGE: this commits deletes old database migrations
This commit is contained in:
parent
78ddf195ff
commit
aeff7f7b51
@ -115,7 +115,7 @@ The application uses [SQLite3](https://www.npmjs.com/package/sqlite3) as a datab
|
||||
|
||||
#### Database Migrations
|
||||
|
||||
Migrations are stored in [src/main/migrations](src/main/migrations) and handled by typeorm. Migrations are run on app start inside [database.ts](src/main/core/database.ts).
|
||||
Migrations are stored in [src/main/migrations](src/main/migrations) and handled by typeorm. Migrations are run on first database connection inside [database.ts](src/main/core/database.ts).
|
||||
|
||||
To auto-generate a migration:
|
||||
`node_modules/.bin/typeorm migration:generate -n <migration name> -c <connection name>`
|
||||
|
@ -22,6 +22,7 @@ const ignoreList = [
|
||||
/^\/buildfile\.js/,
|
||||
/^\/CONTRIBUTING\.md/,
|
||||
/^\/forge\.config\.js/,
|
||||
/^\/ormconfig\.yml/,
|
||||
/^\/package-lock\.json/,
|
||||
/^\/tsconfig\.json/,
|
||||
/^\/webpack\.config\.js/,
|
||||
|
11
ormconfig.yml
Normal file
11
ormconfig.yml
Normal file
@ -0,0 +1,11 @@
|
||||
# this file is only meant to generate migrations via the cli
|
||||
|
||||
library:
|
||||
type: sqlite
|
||||
database: ./test-paths/typeorm/library.db
|
||||
entities:
|
||||
- ./src/main/entities/library/*.js
|
||||
migrations:
|
||||
- ./src/main/migrations/library/*.js
|
||||
cli:
|
||||
migrationsDir: ./src/main/migrations/library
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": ["../../../.eslintrc.json"],
|
||||
"rules": {
|
||||
"max-classes-per-file": "off"
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
import { PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
export class BaseEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
}
|
14
src/main/entities/decorators/percent-check.ts
Normal file
14
src/main/entities/decorators/percent-check.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { Check } from 'typeorm';
|
||||
|
||||
export const minValue = 0;
|
||||
export const maxValue = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
/**
|
||||
* @param column the column which needs to be checked
|
||||
*/
|
||||
export function PercentCheck(column: string): Function {
|
||||
return Check(
|
||||
`${column} needs to be between ${minValue} and ${maxValue}`,
|
||||
`${column} >= ${minValue} AND ${column} <= ${maxValue}`
|
||||
);
|
||||
}
|
24
src/main/entities/library/author-name.ts
Normal file
24
src/main/entities/library/author-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Author } from './author';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class AuthorName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Author,
|
||||
(author: Author) => author.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<Author>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
24
src/main/entities/library/author-role-name.ts
Normal file
24
src/main/entities/library/author-role-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { AuthorRole } from './author-role';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class AuthorRoleName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => AuthorRole,
|
||||
(authorRole: AuthorRole) => authorRole.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<AuthorRole>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
36
src/main/entities/library/author-role.ts
Normal file
36
src/main/entities/library/author-role.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { AuthorRoleName } from './author-role-name';
|
||||
import { WorkAuthor } from './work-author';
|
||||
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes the role an author has in a work.
|
||||
* Examples: story writing, drawing, animating, publishing, ...
|
||||
*/
|
||||
@Entity()
|
||||
export class AuthorRole implements IIdentifiableEntity, IMultiNamedEntity, IDescribableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => AuthorRoleName,
|
||||
(authorRoleName: AuthorRoleName) => authorRoleName.entity
|
||||
)
|
||||
public names: Promise<AuthorRoleName[]>;
|
||||
|
||||
/**
|
||||
* relation to the entity connecting with the author and work
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorkAuthor,
|
||||
(workAuthor: WorkAuthor) => workAuthor.authorRoles
|
||||
)
|
||||
public workAuthors: Promise<WorkAuthor[]>;
|
||||
|
||||
@Column()
|
||||
public description: string;
|
||||
}
|
@ -1,17 +1,32 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Book } from './book';
|
||||
import { AuthorName } from './author-name';
|
||||
import { WorkAuthor } from './work-author';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity represents a single real-world entity, be it a person or named group of persons.
|
||||
*/
|
||||
@Entity()
|
||||
export class Author extends MultiNamed(BaseEntity, 'AuthorMultiName') {
|
||||
@ManyToMany(() => Book, {
|
||||
export class Author implements IIdentifiableEntity, IMultiNamedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
}
|
||||
public nameCanonical: string;
|
||||
|
||||
@Entity()
|
||||
export class AuthorMultiName extends MultiName('Author') {}
|
||||
@OneToMany(
|
||||
() => AuthorName,
|
||||
(authorName: AuthorName) => authorName.entity
|
||||
)
|
||||
public names: Promise<AuthorName[]>;
|
||||
|
||||
/**
|
||||
* ultimately connects the author with a work and their role in that work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => WorkAuthor,
|
||||
(workAuthor: WorkAuthor) => workAuthor.author
|
||||
)
|
||||
public workAuthors: Promise<WorkAuthor[]>;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
import { Check, Column, ManyToOne, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../../base-entity';
|
||||
|
||||
export interface IMultiNamed {
|
||||
nameCanonical: string;
|
||||
multiNames: Promise<IMultiName[]>;
|
||||
}
|
||||
|
||||
export interface IMultiName {
|
||||
name: string;
|
||||
multiNamed: Promise<IMultiNamed>;
|
||||
}
|
||||
|
||||
export function MultiNamed<T extends Constructor>(BaseClass: T = null, multiNameClass: string): T {
|
||||
@Check(`LENGTH(nameCanonical) > 0`)
|
||||
class MixinClass extends BaseClass implements IMultiNamed {
|
||||
@Column()
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(multiNameClass, (multiName: IMultiName) => multiName.multiNamed)
|
||||
public multiNames: Promise<IMultiName[]>;
|
||||
}
|
||||
|
||||
return MixinClass;
|
||||
}
|
||||
|
||||
export function MultiName(multiNamedClass: string): Constructor {
|
||||
@Check(`LENGTH(name) > 0`)
|
||||
class MultiNameClass extends BaseEntity implements IMultiName {
|
||||
@Column()
|
||||
public name: string;
|
||||
|
||||
@ManyToOne(multiNamedClass, (multiNamed: IMultiNamed) => multiNamed.multiNames, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public multiNamed: Promise<IMultiNamed>;
|
||||
}
|
||||
|
||||
return MultiNameClass;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
import { Check, Column } from 'typeorm';
|
||||
|
||||
export const minValue = 0;
|
||||
export const maxValue = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
export interface IRateable {
|
||||
rating: number;
|
||||
}
|
||||
|
||||
export function Rateable<T extends Constructor>(BaseClass: T = null): T {
|
||||
@Check(`rating >= ${minValue} AND rating <= ${maxValue}`)
|
||||
class MixinClass extends BaseClass implements IRateable {
|
||||
@Column({ nullable: true })
|
||||
public rating: number;
|
||||
}
|
||||
|
||||
return MixinClass;
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
import { Entity, JoinTable, ManyToMany, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { Author } from './author';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Character } from './character';
|
||||
import { Copy } from './copy';
|
||||
import { Fiction } from './fiction';
|
||||
import { Tag } from './tag';
|
||||
|
||||
@Entity()
|
||||
export class Book extends MultiNamed(BaseEntity, 'BookMultiName') {
|
||||
@OneToMany(
|
||||
() => Copy,
|
||||
(copy: Copy) => copy.original
|
||||
)
|
||||
public copies: Promise<Copy[]>;
|
||||
|
||||
@ManyToMany(() => Author, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public authors: Promise<Author[]>;
|
||||
|
||||
@ManyToMany(() => Fiction, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public fictions: Promise<Fiction[]>;
|
||||
|
||||
@ManyToMany(() => Character, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public characters: Promise<Character[]>;
|
||||
|
||||
@ManyToMany(() => Tag, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public tags: Promise<Tag[]>;
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class BookMultiName extends MultiName('Book') {}
|
45
src/main/entities/library/character-tag.ts
Normal file
45
src/main/entities/library/character-tag.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { PercentCheck } from '../decorators/percent-check';
|
||||
import { Tag } from './tag';
|
||||
import { WorkCharacter } from './work-character';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This tag entity tags a character in a work.
|
||||
*/
|
||||
@Entity()
|
||||
@PercentCheck('weight')
|
||||
export class CharacterTag implements IIdentifiableEntity, IWeightedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the character ina work this tag describes
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.characterTags,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public workCharacter: Promise<WorkCharacter>;
|
||||
|
||||
/**
|
||||
* the describing tag
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.characterTags,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public tag: Promise<Tag>;
|
||||
|
||||
@Column()
|
||||
public weight: number;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Book } from './book';
|
||||
import { Fiction } from './fiction';
|
||||
|
||||
@Entity()
|
||||
export class Character extends MultiNamed(BaseEntity, 'CharacterMultiName') {
|
||||
@ManyToMany(() => Book, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
|
||||
@ManyToMany(() => Fiction, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public fictions: Promise<Fiction[]>;
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class CharacterMultiName extends MultiName('Character') {}
|
24
src/main/entities/library/collection-name.ts
Normal file
24
src/main/entities/library/collection-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Collection } from './collection';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class CollectionName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Collection,
|
||||
(collection: Collection) => collection.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<Collection>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
47
src/main/entities/library/collection-part.ts
Normal file
47
src/main/entities/library/collection-part.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { Collection } from './collection';
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity orders works in a collection.
|
||||
* The main use case is chronological ordering.
|
||||
*/
|
||||
@Entity()
|
||||
export class CollectionPart implements IIdentifiableEntity, IOrderableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the collection thw work is a part of
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Collection,
|
||||
(collection: Collection) => collection.parts,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public collection: Promise<Collection>;
|
||||
|
||||
/**
|
||||
* the work inside the collection
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.collectionParts,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public work: Promise<Work>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: 0,
|
||||
})
|
||||
public order: number;
|
||||
}
|
35
src/main/entities/library/collection.ts
Normal file
35
src/main/entities/library/collection.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { CollectionName } from './collection-name';
|
||||
import { CollectionPart } from './collection-part';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* A collection is a set of works.
|
||||
* For example, this can be a series or a set of alternate angles.
|
||||
* What constitutes as a collection is ultimately up to the user.
|
||||
*
|
||||
* As a general rule of thumb:
|
||||
* If authors of works see them as belonging together, they are a collection
|
||||
*/
|
||||
@Entity()
|
||||
export class Collection implements IIdentifiableEntity, IMultiNamedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column()
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => CollectionName,
|
||||
(collectionName: CollectionName) => collectionName.entity
|
||||
)
|
||||
public names: Promise<CollectionName[]>;
|
||||
|
||||
/**
|
||||
* the connecting entity between this collection and the work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => CollectionPart,
|
||||
(collectionPart: CollectionPart) => collectionPart.collection
|
||||
)
|
||||
public parts: Promise<CollectionPart[]>;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import { Column, Entity, ManyToOne } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { Copy } from './copy';
|
||||
|
||||
const enum CopyTypes {
|
||||
ORIGINAL = 'original',
|
||||
TRANSLATED = 'translated',
|
||||
UNCENSORED = 'uncensored',
|
||||
OTHER = 'other',
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class CopyType extends BaseEntity {
|
||||
@ManyToOne(
|
||||
() => Copy,
|
||||
(copy: Copy) => copy.types,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public copy: Promise<Copy>;
|
||||
|
||||
@Column({ nullable: false })
|
||||
public type: CopyTypes;
|
||||
|
||||
@Column({ nullable: true })
|
||||
public comment: string;
|
||||
}
|
@ -1,58 +1,64 @@
|
||||
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { Rateable } from './base/rateable';
|
||||
import { Book } from './book';
|
||||
import { CopyType } from './copy-type';
|
||||
import { Language } from './language';
|
||||
import { Source } from './source';
|
||||
import { Translator } from './translator';
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* A copy is the digital counterpart of a work.
|
||||
* It corresponds to a unique file or set of files which represent the work on the users device.
|
||||
*
|
||||
* Multiple works can have multiple copies (think of different scans of a physical work, or lossy compression).
|
||||
*/
|
||||
@Entity()
|
||||
export class Copy extends Rateable(BaseEntity) {
|
||||
export class Copy implements IIdentifiableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the work this entity is a copy of
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Book,
|
||||
(book: Book) => book.copies,
|
||||
() => Work,
|
||||
(work: Work) => work.copies,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public original: Promise<Book>;
|
||||
public original: Promise<Work>;
|
||||
|
||||
@Column({ nullable: false, default: false })
|
||||
public favorited: boolean;
|
||||
|
||||
@OneToMany(
|
||||
() => CopyType,
|
||||
(copyType: CopyType) => copyType.copy
|
||||
/**
|
||||
* where to find this specific copy
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => Source,
|
||||
(source: Source) => source.copies
|
||||
)
|
||||
public types: Promise<CopyType[]>;
|
||||
|
||||
@Column({ nullable: false })
|
||||
public isDigital: boolean;
|
||||
|
||||
@ManyToMany(() => Source, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public sources: Promise<Source[]>;
|
||||
|
||||
@ManyToMany(() => Language, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
/**
|
||||
* identifying hash of the file contents
|
||||
*/
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
@JoinTable()
|
||||
public languages: Promise<Language[]>;
|
||||
public hash: string;
|
||||
|
||||
@ManyToMany(() => Translator, {
|
||||
/**
|
||||
* device location of the copy
|
||||
*/
|
||||
@Column({
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinTable()
|
||||
public translators: Promise<Translator[]>;
|
||||
public location: string;
|
||||
|
||||
/**
|
||||
* the ordering of the copies belonging to the same work,
|
||||
* lower number is higher ranked
|
||||
*/
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: 0,
|
||||
})
|
||||
public ranking: number;
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Book } from './book';
|
||||
import { Character } from './character';
|
||||
|
||||
@Entity()
|
||||
export class Fiction extends MultiNamed(BaseEntity, 'FictionMultiName') {
|
||||
@ManyToMany(() => Book, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
|
||||
@ManyToMany(() => Character, {
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public characters: Promise<Character[]>;
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class FictionMultiName extends MultiName('Fiction') {}
|
9
src/main/entities/library/i-describable-entity.d.ts
vendored
Normal file
9
src/main/entities/library/i-describable-entity.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Entities extending this one have a user-maintained description.
|
||||
*/
|
||||
declare interface IDescribableEntity {
|
||||
/**
|
||||
* a text describing this entity
|
||||
*/
|
||||
description: string;
|
||||
}
|
14
src/main/entities/library/i-hierachical-entity.d.ts
vendored
Normal file
14
src/main/entities/library/i-hierachical-entity.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Entities implementing this interface build a hierarchy.
|
||||
*/
|
||||
declare interface IHierachicalEntity<T> {
|
||||
/**
|
||||
* parent entities
|
||||
*/
|
||||
parents: Promise<T[]>;
|
||||
|
||||
/**
|
||||
* child entities
|
||||
*/
|
||||
children: Promise<T[]>;
|
||||
}
|
10
src/main/entities/library/i-identifiable-entity.d.ts
vendored
Normal file
10
src/main/entities/library/i-identifiable-entity.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Every database entity should implement this one.
|
||||
* It does nothing more but guarantee there is an id column.
|
||||
*/
|
||||
declare interface IIdentifiableEntity {
|
||||
/**
|
||||
* the entity id
|
||||
*/
|
||||
id: number;
|
||||
}
|
14
src/main/entities/library/i-multi-named-entity.d.ts
vendored
Normal file
14
src/main/entities/library/i-multi-named-entity.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Entities extending this interface can have multiple names.
|
||||
*/
|
||||
declare interface IMultiNamedEntity {
|
||||
/**
|
||||
* the name which is displayed in the user interface
|
||||
*/
|
||||
nameCanonical: string;
|
||||
|
||||
/**
|
||||
* other names for the entity
|
||||
*/
|
||||
names: Promise<INameEntity[]>;
|
||||
}
|
14
src/main/entities/library/i-name-entity.d.ts
vendored
Normal file
14
src/main/entities/library/i-name-entity.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* This entity describes a single name of an entity with multiple names.
|
||||
*/
|
||||
declare interface INameEntity {
|
||||
/**
|
||||
* the name
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* the entity to which the names belong
|
||||
*/
|
||||
entity: Promise<IMultiNamedEntity>;
|
||||
}
|
9
src/main/entities/library/i-orderable-entity.d.ts
vendored
Normal file
9
src/main/entities/library/i-orderable-entity.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Entities implenting this interface can be ordered.
|
||||
*/
|
||||
declare interface IOrderableEntity {
|
||||
/**
|
||||
* a lower number means a higher ordering
|
||||
*/
|
||||
order: number;
|
||||
}
|
9
src/main/entities/library/i-weighted-entity.d.ts
vendored
Normal file
9
src/main/entities/library/i-weighted-entity.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/**
|
||||
* An entity implementing this interface has a weight property.
|
||||
*/
|
||||
declare interface IWeightedEntity {
|
||||
/**
|
||||
* the weight, mathematically a number (0,1], practically between (0,Number.MAX_SAFE_INTEGER]
|
||||
*/
|
||||
weight: number;
|
||||
}
|
49
src/main/entities/library/interaction-tag.ts
Normal file
49
src/main/entities/library/interaction-tag.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { PercentCheck } from '../decorators/percent-check';
|
||||
import { Tag } from './tag';
|
||||
import { WorkCharacter } from './work-character';
|
||||
import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This tag entity tags an interaction between two characters.
|
||||
*/
|
||||
@Entity()
|
||||
@PercentCheck('weight')
|
||||
export class InteractionTag implements IIdentifiableEntity, IWeightedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the describing tag
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.interactionTags,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public tag: Promise<Tag>;
|
||||
|
||||
/**
|
||||
* the actors of this interaction
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.interactWith
|
||||
)
|
||||
public subjectCharacters: Promise<WorkCharacter[]>;
|
||||
|
||||
/**
|
||||
* the receivers of this interaction
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.interactedBy
|
||||
)
|
||||
public objectCharacters: Promise<WorkCharacter[]>;
|
||||
|
||||
@Column()
|
||||
public weight: number;
|
||||
}
|
@ -1,19 +1,23 @@
|
||||
import { Column, Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { Copy } from './copy';
|
||||
import { Work } from './work';
|
||||
import { Entity, ManyToMany, PrimaryColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity is non-user-maintained and describes a language.
|
||||
*/
|
||||
@Entity()
|
||||
export class Language extends BaseEntity {
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
})
|
||||
export class Language {
|
||||
/**
|
||||
* ISO 639-1 two-letter language code
|
||||
*/
|
||||
@PrimaryColumn()
|
||||
public code: string;
|
||||
|
||||
@ManyToMany(() => Copy, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public copies: Promise<Copy[]>;
|
||||
/**
|
||||
* the works using this language
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => Work,
|
||||
(work: Work) => work.languages
|
||||
)
|
||||
public works: Promise<Work[]>;
|
||||
}
|
||||
|
24
src/main/entities/library/site-name.ts
Normal file
24
src/main/entities/library/site-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Site } from './site';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class SiteName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Site,
|
||||
(site: Site) => site.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<Site>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
@ -1,16 +1,32 @@
|
||||
import { Entity, OneToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { SiteName } from './site-name';
|
||||
import { Source } from './source';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This non-user-maintained entity describes an online provider of works which can be scraped.
|
||||
*/
|
||||
@Entity()
|
||||
export class Site extends MultiNamed(BaseEntity, 'SiteMultiName') {
|
||||
export class Site implements IIdentifiableEntity, IMultiNamedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => SiteName,
|
||||
(siteName: SiteName) => siteName.entity
|
||||
)
|
||||
public names: Promise<SiteName[]>;
|
||||
|
||||
/**
|
||||
* sources belonging to this site
|
||||
*/
|
||||
@OneToMany(
|
||||
() => Source,
|
||||
(source: Source) => source.site
|
||||
)
|
||||
public sources: Promise<Source[]>;
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class SiteMultiName extends MultiName('Site') {}
|
||||
|
@ -1,31 +1,43 @@
|
||||
import { Column, Entity, ManyToMany, ManyToOne } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { Copy } from './copy';
|
||||
import { Site } from './site';
|
||||
import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes an external source of a copy, in most cases that is a website.
|
||||
*/
|
||||
@Entity()
|
||||
export class Source extends BaseEntity {
|
||||
export class Source implements IIdentifiableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the uri to the sauce
|
||||
*/
|
||||
@Column({
|
||||
nullable: false,
|
||||
unique: true,
|
||||
})
|
||||
public uri: string;
|
||||
|
||||
/**
|
||||
* the site connected to the source
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Site,
|
||||
(site: Site) => site.sources,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
nullable: true,
|
||||
onDelete: 'RESTRICT',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public site: Promise<Site>;
|
||||
|
||||
@ManyToMany(() => Copy, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
/**
|
||||
* the copies which can be found here
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => Copy,
|
||||
(copy: Copy) => copy.sources
|
||||
)
|
||||
public copies: Promise<Copy[]>;
|
||||
}
|
||||
|
24
src/main/entities/library/tag-name.ts
Normal file
24
src/main/entities/library/tag-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Tag } from './tag';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class TagName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<Tag>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
@ -1,17 +1,72 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Book } from './book';
|
||||
import { CharacterTag } from './character-tag';
|
||||
import { InteractionTag } from './interaction-tag';
|
||||
import { TagName } from './tag-name';
|
||||
import { WorkTag } from './work-tag';
|
||||
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity is the main tag entity.
|
||||
* Tags have a name and a description.
|
||||
* They can tag a work, a character, or a character interaction.
|
||||
* They can also be in a hierarchy
|
||||
*/
|
||||
@Entity()
|
||||
export class Tag extends MultiNamed(BaseEntity, 'TagMultiName') {
|
||||
@ManyToMany(() => Book, {
|
||||
export class Tag implements IIdentifiableEntity, IMultiNamedEntity, IDescribableEntity, IHierachicalEntity<Tag> {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public books: Promise<Book[]>;
|
||||
}
|
||||
public nameCanonical: string;
|
||||
|
||||
@Entity()
|
||||
export class TagMultiName extends MultiName('Tag') {}
|
||||
@OneToMany(
|
||||
() => TagName,
|
||||
(tagName: TagName) => tagName.entity
|
||||
)
|
||||
public names: Promise<TagName[]>;
|
||||
|
||||
/**
|
||||
* this tag tagging a work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => WorkTag,
|
||||
(workTag: WorkTag) => workTag.tag
|
||||
)
|
||||
public workTags: Promise<WorkTag[]>;
|
||||
|
||||
/**
|
||||
* this tag tagging characters
|
||||
*/
|
||||
@OneToMany(
|
||||
() => CharacterTag,
|
||||
(characterTag: CharacterTag) => characterTag.tag
|
||||
)
|
||||
public characterTags: Promise<CharacterTag[]>;
|
||||
|
||||
/**
|
||||
* this tag tagging a character interaction
|
||||
*/
|
||||
@OneToMany(
|
||||
() => InteractionTag,
|
||||
(interactionTag: InteractionTag) => interactionTag.tag
|
||||
)
|
||||
public interactionTags: Promise<InteractionTag[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.children
|
||||
)
|
||||
public parents: Promise<Tag[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.parents
|
||||
)
|
||||
public children: Promise<Tag[]>;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
public description: string;
|
||||
}
|
||||
|
24
src/main/entities/library/transformation-type-name.ts
Normal file
24
src/main/entities/library/transformation-type-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { TransformationType } from './transformation-type';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class TransformationTypeName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => TransformationType,
|
||||
(transformationType: TransformationType) => transformationType.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<TransformationType>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
47
src/main/entities/library/transformation-type.ts
Normal file
47
src/main/entities/library/transformation-type.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { Transformation } from './transformation';
|
||||
import { TransformationTypeName } from './transformation-type-name';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes a transformation type.
|
||||
* Possible type: translation, decensor, collection, ...
|
||||
*/
|
||||
@Entity()
|
||||
export class TransformationType implements IIdentifiableEntity, IMultiNamedEntity, IDescribableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => TransformationTypeName,
|
||||
(transformationTypeName: TransformationTypeName) => transformationTypeName.entity
|
||||
)
|
||||
public names: Promise<TransformationTypeName[]>;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
public description: string;
|
||||
|
||||
/**
|
||||
* the transformations of this type
|
||||
*/
|
||||
@OneToMany(
|
||||
() => Transformation,
|
||||
(transformation: Transformation) => transformation.type
|
||||
)
|
||||
public transformations: Promise<Transformation[]>;
|
||||
|
||||
/**
|
||||
* if that trnasformation conserves the tags of the original work
|
||||
*/
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: false,
|
||||
})
|
||||
public conservesTags: boolean;
|
||||
}
|
60
src/main/entities/library/transformation.ts
Normal file
60
src/main/entities/library/transformation.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import { TransformationType } from './transformation-type';
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes how one work is transformed to another.
|
||||
*/
|
||||
@Entity()
|
||||
export class Transformation implements IIdentifiableEntity, IOrderableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the work based on the original
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.transformationOf,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public byWork: Promise<Work>;
|
||||
|
||||
/**
|
||||
* the transformation type
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => TransformationType,
|
||||
(transformationType: TransformationType) => transformationType.transformations,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'RESTRICT',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public type: Promise<TransformationType>;
|
||||
|
||||
/**
|
||||
* the original work
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.transformedBy,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public ofWork: Promise<Work>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: 0,
|
||||
})
|
||||
public order: number;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import { Entity, ManyToMany } from 'typeorm';
|
||||
import { BaseEntity } from '../base-entity';
|
||||
import { MultiName, MultiNamed } from './base/multi-named';
|
||||
import { Copy } from './copy';
|
||||
|
||||
@Entity()
|
||||
export class Translator extends MultiNamed(BaseEntity, 'TranslatorMultiName') {
|
||||
@ManyToMany(() => Copy, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
public copies: Promise<Copy[]>;
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class TranslatorMultiName extends MultiName('Translator') {}
|
56
src/main/entities/library/work-author.ts
Normal file
56
src/main/entities/library/work-author.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { Author } from './author';
|
||||
import { AuthorRole } from './author-role';
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity connects authors with their work and their role therein.
|
||||
*/
|
||||
@Entity()
|
||||
export class WorkAuthor implements IIdentifiableEntity, IOrderableEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the work
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.workAuthors,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public work: Promise<Work>;
|
||||
|
||||
/**
|
||||
* the roles of the author in the work
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => AuthorRole,
|
||||
(authorRole: AuthorRole) => authorRole.workAuthors
|
||||
)
|
||||
public authorRoles: Promise<AuthorRole[]>;
|
||||
|
||||
/**
|
||||
* the author
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Author,
|
||||
(author: Author) => author.workAuthors,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'RESTRICT',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public author: Promise<Author>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: 0,
|
||||
})
|
||||
public order: number;
|
||||
}
|
24
src/main/entities/library/work-character-name.ts
Normal file
24
src/main/entities/library/work-character-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { WorkCharacter } from './work-character';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class WorkCharacterName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<WorkCharacter>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
77
src/main/entities/library/work-character.ts
Normal file
77
src/main/entities/library/work-character.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import { CharacterTag } from './character-tag';
|
||||
import { InteractionTag } from './interaction-tag';
|
||||
import { Work } from './work';
|
||||
import { WorkCharacterName } from './work-character-name';
|
||||
import { WorldCharacter } from './world-character';
|
||||
import { Column, Entity, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes a character in a work.
|
||||
* The character can be original or based on one or more existing characters.
|
||||
*/
|
||||
@Entity()
|
||||
export class WorkCharacter implements IIdentifiableEntity, IMultiNamedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => WorkCharacterName,
|
||||
(workCharacterName: WorkCharacterName) => workCharacterName.entity
|
||||
)
|
||||
public names: Promise<WorkCharacterName[]>;
|
||||
|
||||
/**
|
||||
* the work the character is a part of
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.workCharacters,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public work: Promise<Work>;
|
||||
|
||||
/**
|
||||
* interaction with other characters as actor
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => InteractionTag,
|
||||
(interactionTag: InteractionTag) => interactionTag.subjectCharacters
|
||||
)
|
||||
public interactWith: Promise<InteractionTag[]>;
|
||||
|
||||
/**
|
||||
* interaction with other characters as receiver
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => InteractionTag,
|
||||
(interactionTag: InteractionTag) => interactionTag.objectCharacters
|
||||
)
|
||||
public interactedBy: Promise<InteractionTag[]>;
|
||||
|
||||
/**
|
||||
* tags connected to the character
|
||||
*/
|
||||
@OneToMany(
|
||||
() => CharacterTag,
|
||||
(characterTag: CharacterTag) => characterTag.workCharacter
|
||||
)
|
||||
public characterTags: Promise<CharacterTag[]>;
|
||||
|
||||
/**
|
||||
* existing characters characer is based on
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorldCharacter,
|
||||
(worldCharacter: WorldCharacter) => worldCharacter.workCharacters
|
||||
)
|
||||
public worldCharacters: Promise<WorldCharacter[]>;
|
||||
}
|
24
src/main/entities/library/work-name.ts
Normal file
24
src/main/entities/library/work-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class WorkName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<Work>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
45
src/main/entities/library/work-tag.ts
Normal file
45
src/main/entities/library/work-tag.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { PercentCheck } from '../decorators/percent-check';
|
||||
import { Tag } from './tag';
|
||||
import { Work } from './work';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This tag entity tags a work.
|
||||
*/
|
||||
@Entity()
|
||||
@PercentCheck('weight')
|
||||
export class WorkTag implements IIdentifiableEntity, IWeightedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
/**
|
||||
* the describing tag
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Tag,
|
||||
(tag: Tag) => tag.workTags,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public tag: Promise<Tag>;
|
||||
|
||||
/**
|
||||
* the tagged work
|
||||
*/
|
||||
@ManyToOne(
|
||||
() => Work,
|
||||
(work: Work) => work.workTags,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public work: Promise<Work>;
|
||||
|
||||
@Column()
|
||||
public weight: number;
|
||||
}
|
140
src/main/entities/library/work.ts
Normal file
140
src/main/entities/library/work.ts
Normal file
@ -0,0 +1,140 @@
|
||||
import { PercentCheck } from '../decorators/percent-check';
|
||||
import { CollectionPart } from './collection-part';
|
||||
import { Copy } from './copy';
|
||||
import { Language } from './language';
|
||||
import { Transformation } from './transformation';
|
||||
import { WorkAuthor } from './work-author';
|
||||
import { WorkCharacter } from './work-character';
|
||||
import { WorkName } from './work-name';
|
||||
import { WorkTag } from './work-tag';
|
||||
import { World } from './world';
|
||||
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This is the main library entity.
|
||||
*
|
||||
* It describes a work of art organized by this software.
|
||||
*/
|
||||
@Entity()
|
||||
@PercentCheck('rating')
|
||||
export class Work implements IIdentifiableEntity, IMultiNamedEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => WorkName,
|
||||
(workName: WorkName) => workName.entity
|
||||
)
|
||||
public names: Promise<WorkName[]>;
|
||||
|
||||
/**
|
||||
* digital representations of this work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => Copy,
|
||||
(copy: Copy) => copy.original
|
||||
)
|
||||
public copies: Promise<Copy[]>;
|
||||
|
||||
/**
|
||||
* other works this work is a transformation of
|
||||
*/
|
||||
@OneToMany(
|
||||
() => Transformation,
|
||||
(transformation: Transformation) => transformation.byWork
|
||||
)
|
||||
public transformationOf: Promise<Transformation[]>;
|
||||
|
||||
/**
|
||||
* other works this work is transformed by
|
||||
*/
|
||||
@OneToMany(
|
||||
() => Transformation,
|
||||
(transformation: Transformation) => transformation.ofWork
|
||||
)
|
||||
public transformedBy: Promise<Transformation[]>;
|
||||
|
||||
/**
|
||||
* the authors/publishers of this work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => WorkAuthor,
|
||||
(workAuthor: WorkAuthor) => workAuthor.work
|
||||
)
|
||||
public workAuthors: Promise<WorkAuthor[]>;
|
||||
|
||||
/**
|
||||
* tags describing this work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => WorkTag,
|
||||
(workTag: WorkTag) => workTag.work
|
||||
)
|
||||
public workTags: Promise<WorkTag[]>;
|
||||
|
||||
/**
|
||||
* characters in this work
|
||||
*/
|
||||
@OneToMany(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.work
|
||||
)
|
||||
public workCharacters: Promise<WorkCharacter[]>;
|
||||
|
||||
/**
|
||||
* fictional worlds in which this work takes place
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => World,
|
||||
(world: World) => world.works
|
||||
)
|
||||
public worlds: Promise<World[]>;
|
||||
|
||||
/**
|
||||
* if this work i canon in above fictional world
|
||||
*/
|
||||
@Column({
|
||||
nullable: false,
|
||||
default: false,
|
||||
})
|
||||
public isCanonical: boolean;
|
||||
|
||||
/**
|
||||
* the user rating of this work
|
||||
*/
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
public rating: number;
|
||||
|
||||
/**
|
||||
* the release date of the work
|
||||
*/
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
public releaseDate: Date;
|
||||
|
||||
/**
|
||||
* the languages of the work (if applicable)
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => Language,
|
||||
(language: Language) => language.works
|
||||
)
|
||||
public languages: Promise<Language[]>;
|
||||
|
||||
/**
|
||||
* the collections this work is a part of
|
||||
*/
|
||||
@OneToMany(
|
||||
() => CollectionPart,
|
||||
(collectionPart: CollectionPart) => collectionPart.work
|
||||
)
|
||||
public collectionParts: Promise<CollectionPart[]>;
|
||||
}
|
24
src/main/entities/library/world-character-name.ts
Normal file
24
src/main/entities/library/world-character-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { WorldCharacter } from './world-character';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class WorldCharacterName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => WorldCharacter,
|
||||
(worldCharacter: WorldCharacter) => worldCharacter.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<WorldCharacter>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
54
src/main/entities/library/world-character.ts
Normal file
54
src/main/entities/library/world-character.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { WorkCharacter } from './work-character';
|
||||
import { World } from './world';
|
||||
import { WorldCharacterName } from './world-character-name';
|
||||
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes a canon character in a fictional world.
|
||||
*/
|
||||
@Entity()
|
||||
export class WorldCharacter implements IIdentifiableEntity, IMultiNamedEntity, IHierachicalEntity<WorldCharacter> {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => WorldCharacterName,
|
||||
(worldCharacterName: WorldCharacterName) => worldCharacterName.entity
|
||||
)
|
||||
public names: Promise<WorldCharacterName[]>;
|
||||
|
||||
/**
|
||||
* the characters in works which are based on this one
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorkCharacter,
|
||||
(workCharacter: WorkCharacter) => workCharacter.worldCharacters
|
||||
)
|
||||
public workCharacters: Promise<WorkCharacter[]>;
|
||||
|
||||
/**
|
||||
* the fictional worlds this character is a part of
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => World,
|
||||
(world: World) => world.worldCharacters
|
||||
)
|
||||
public worlds: Promise<World[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => WorldCharacter,
|
||||
(worldCharacter: WorldCharacter) => worldCharacter.children
|
||||
)
|
||||
public parents: Promise<WorldCharacter[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => WorldCharacter,
|
||||
(worldCharacter: WorldCharacter) => worldCharacter.parents
|
||||
)
|
||||
public children: Promise<WorldCharacter[]>;
|
||||
}
|
24
src/main/entities/library/world-name.ts
Normal file
24
src/main/entities/library/world-name.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { World } from './world';
|
||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class WorldName implements IIdentifiableEntity, INameEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@ManyToOne(
|
||||
() => World,
|
||||
(world: World) => world.names,
|
||||
{
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
}
|
||||
)
|
||||
public entity: Promise<World>;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public name: string;
|
||||
}
|
54
src/main/entities/library/world.ts
Normal file
54
src/main/entities/library/world.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { Work } from './work';
|
||||
import { WorldCharacter } from './world-character';
|
||||
import { WorldName } from './world-name';
|
||||
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
/**
|
||||
* This entity describes a fictional world.
|
||||
*/
|
||||
@Entity()
|
||||
export class World implements IIdentifiableEntity, IMultiNamedEntity, IHierachicalEntity<World> {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({
|
||||
nullable: false,
|
||||
})
|
||||
public nameCanonical: string;
|
||||
|
||||
@OneToMany(
|
||||
() => WorldName,
|
||||
(worldName: WorldName) => worldName.entity
|
||||
)
|
||||
public names: Promise<WorldName[]>;
|
||||
|
||||
/**
|
||||
* works taking place in this world
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => Work,
|
||||
(work: Work) => work.worlds
|
||||
)
|
||||
public works: Promise<Work[]>;
|
||||
|
||||
/**
|
||||
* canon characters in this world
|
||||
*/
|
||||
@ManyToMany(
|
||||
() => WorldCharacter,
|
||||
(worldCharacter: WorldCharacter) => worldCharacter.worlds
|
||||
)
|
||||
public worldCharacters: Promise<WorldCharacter[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => World,
|
||||
(world: World) => world.parents
|
||||
)
|
||||
public children: Promise<World[]>;
|
||||
|
||||
@ManyToMany(
|
||||
() => World,
|
||||
(world: World) => world.children
|
||||
)
|
||||
public parents: Promise<World[]>;
|
||||
}
|
@ -1,698 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class initialMigration1574609063879 implements MigrationInterface {
|
||||
name = 'initialMigration1574609063879';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "fiction" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_ece48040a8ab27691c59392255" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "fiction_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_39f907c54d00784d2468156af2" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_2c5dc413ea252434cf75507f97" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "character_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8f6325928e3a0cc9b78b52f6dc" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "language" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "code" varchar NOT NULL, CONSTRAINT "UQ_465b3173cdddf0ac2d3fe73a33c" UNIQUE ("code"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_2e45adb601d323481a26a5d747" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8dc8533fce07e041aa8474da05" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer NOT NULL, CONSTRAINT "UQ_028f4c3a05a9bfcddb95a4916b9" UNIQUE ("uri"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "translator" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_4889d3449c1587168e8dcea2ec" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "translator_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_0652150dacaf6454a4cd6811de" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "rating" integer, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL, CONSTRAINT "CHK_f6e0d7b6b3e80ad96e2a1dda43" CHECK (rating >= 0 AND rating <= 9007199254740991))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_572e2fc78872b516f62ff02a88" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_ab521dd46cf7699c4abf75b76b" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "rating" integer, CONSTRAINT "CHK_bbef8dbd3571ec559f7a980fc5" CHECK (LENGTH(nameCanonical) > 0), CONSTRAINT "CHK_62ebe0be1f2d31406118960aa5" CHECK (rating >= 0 AND rating <= 9007199254740991))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_f989db6a159c4614d635ad6ad5" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_6fb4af6989bffdf1b04f3724a4" CHECK (LENGTH(nameCanonical) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_4d153aa4b33f8254933d224fe0" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_sources_source" ("copyId" integer NOT NULL, "sourceId" integer NOT NULL, PRIMARY KEY ("copyId", "sourceId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_653c33c5db26b8736e592ff3f6" ON "copy_sources_source" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_946af3644f779b7cc7e7eb04eb" ON "copy_sources_source" ("sourceId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_languages_language" ("copyId" integer NOT NULL, "languageId" integer NOT NULL, PRIMARY KEY ("copyId", "languageId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_056de447bd9e4b2efdf5eafe49" ON "copy_languages_language" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c6adacfab107dc725d4fb5864b" ON "copy_languages_language" ("languageId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_translators_translator" ("copyId" integer NOT NULL, "translatorId" integer NOT NULL, PRIMARY KEY ("copyId", "translatorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2a20d8eaf28ebc28438271899f" ON "copy_translators_translator" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e19e5193f168ce07f52f15be06" ON "copy_translators_translator" ("translatorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_authors_author" ("bookId" integer NOT NULL, "authorId" integer NOT NULL, PRIMARY KEY ("bookId", "authorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9bf58ffb2a12a8609a738ee8ca" ON "book_authors_author" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a4cafdf2ec9974524a5321c751" ON "book_authors_author" ("authorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_fictions_fiction" ("bookId" integer NOT NULL, "fictionId" integer NOT NULL, PRIMARY KEY ("bookId", "fictionId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_characters_character" ("bookId" integer NOT NULL, "characterId" integer NOT NULL, PRIMARY KEY ("bookId", "characterId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_tags_tag" ("bookId" integer NOT NULL, "tagId" integer NOT NULL, PRIMARY KEY ("bookId", "tagId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_918a7b7552fe5fd66f328d4fe8" ON "book_tags_tag" ("bookId") `, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_5274aca0a1468ed55afdfaba24" ON "book_tags_tag" ("tagId") `, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_fiction_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_39f907c54d00784d2468156af2" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_c95f6982a15bf8adc487e554d9d" FOREIGN KEY ("multiNamedId") REFERENCES "fiction" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_fiction_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "fiction_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "fiction_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_fiction_multi_name" RENAME TO "fiction_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_character_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8f6325928e3a0cc9b78b52f6dc" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_85051dd2e242ae03efab36fba2d" FOREIGN KEY ("multiNamedId") REFERENCES "character" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_character_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "character_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "character_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_character_multi_name" RENAME TO "character_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy_type"("id", "type", "comment", "copyId") SELECT "id", "type", "comment", "copyId" FROM "copy_type"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy_type"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_copy_type" RENAME TO "copy_type"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_site_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8dc8533fce07e041aa8474da05" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_d5ebcbd5364c68cad5d1d517b6a" FOREIGN KEY ("multiNamedId") REFERENCES "site" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_site_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "site_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "site_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_site_multi_name" RENAME TO "site_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer NOT NULL, CONSTRAINT "UQ_028f4c3a05a9bfcddb95a4916b9" UNIQUE ("uri"), CONSTRAINT "FK_73b253e679f350d140bdb104e49" FOREIGN KEY ("siteId") REFERENCES "site" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "source"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_source" RENAME TO "source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_translator_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_0652150dacaf6454a4cd6811de" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_24720bc98312cb5ccd89c096dd4" FOREIGN KEY ("multiNamedId") REFERENCES "translator" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_translator_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "translator_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "translator_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_translator_multi_name" RENAME TO "translator_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "rating" integer, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL, CONSTRAINT "CHK_f6e0d7b6b3e80ad96e2a1dda43" CHECK (rating >= 0 AND rating <= 9007199254740991), CONSTRAINT "FK_e8ce0011cf0a8b9fdc8ad908a44" FOREIGN KEY ("originalId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy"("id", "rating", "favorited", "isDigital", "originalId") SELECT "id", "rating", "favorited", "isDigital", "originalId" FROM "copy"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_copy" RENAME TO "copy"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_tag_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_ab521dd46cf7699c4abf75b76b" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_34c0efcd4e11775f6e781708bda" FOREIGN KEY ("multiNamedId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_tag_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "tag_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "tag_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_tag_multi_name" RENAME TO "tag_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_f989db6a159c4614d635ad6ad5" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_191d56679fe812b502a6ac24cc7" FOREIGN KEY ("multiNamedId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "book_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_book_multi_name" RENAME TO "book_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_author_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_4d153aa4b33f8254933d224fe0" CHECK (LENGTH(name) > 0), CONSTRAINT "FK_f3aad920c89bea8e5e7ef67d887" FOREIGN KEY ("multiNamedId") REFERENCES "author" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_author_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "author_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "author_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_author_multi_name" RENAME TO "author_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_653c33c5db26b8736e592ff3f6"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_946af3644f779b7cc7e7eb04eb"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy_sources_source" ("copyId" integer NOT NULL, "sourceId" integer NOT NULL, CONSTRAINT "FK_653c33c5db26b8736e592ff3f65" FOREIGN KEY ("copyId") REFERENCES "copy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_946af3644f779b7cc7e7eb04eb7" FOREIGN KEY ("sourceId") REFERENCES "source" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("copyId", "sourceId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy_sources_source"("copyId", "sourceId") SELECT "copyId", "sourceId" FROM "copy_sources_source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy_sources_source"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_copy_sources_source" RENAME TO "copy_sources_source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_653c33c5db26b8736e592ff3f6" ON "copy_sources_source" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_946af3644f779b7cc7e7eb04eb" ON "copy_sources_source" ("sourceId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_056de447bd9e4b2efdf5eafe49"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c6adacfab107dc725d4fb5864b"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy_languages_language" ("copyId" integer NOT NULL, "languageId" integer NOT NULL, CONSTRAINT "FK_056de447bd9e4b2efdf5eafe497" FOREIGN KEY ("copyId") REFERENCES "copy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_c6adacfab107dc725d4fb5864be" FOREIGN KEY ("languageId") REFERENCES "language" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("copyId", "languageId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy_languages_language"("copyId", "languageId") SELECT "copyId", "languageId" FROM "copy_languages_language"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy_languages_language"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_copy_languages_language" RENAME TO "copy_languages_language"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_056de447bd9e4b2efdf5eafe49" ON "copy_languages_language" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c6adacfab107dc725d4fb5864b" ON "copy_languages_language" ("languageId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2a20d8eaf28ebc28438271899f"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e19e5193f168ce07f52f15be06"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_copy_translators_translator" ("copyId" integer NOT NULL, "translatorId" integer NOT NULL, CONSTRAINT "FK_2a20d8eaf28ebc28438271899f5" FOREIGN KEY ("copyId") REFERENCES "copy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_e19e5193f168ce07f52f15be068" FOREIGN KEY ("translatorId") REFERENCES "translator" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("copyId", "translatorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy_translators_translator"("copyId", "translatorId") SELECT "copyId", "translatorId" FROM "copy_translators_translator"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy_translators_translator"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_copy_translators_translator" RENAME TO "copy_translators_translator"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2a20d8eaf28ebc28438271899f" ON "copy_translators_translator" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e19e5193f168ce07f52f15be06" ON "copy_translators_translator" ("translatorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9bf58ffb2a12a8609a738ee8ca"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a4cafdf2ec9974524a5321c751"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book_authors_author" ("bookId" integer NOT NULL, "authorId" integer NOT NULL, CONSTRAINT "FK_9bf58ffb2a12a8609a738ee8cae" FOREIGN KEY ("bookId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_a4cafdf2ec9974524a5321c7516" FOREIGN KEY ("authorId") REFERENCES "author" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("bookId", "authorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_authors_author"("bookId", "authorId") SELECT "bookId", "authorId" FROM "book_authors_author"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_authors_author"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_book_authors_author" RENAME TO "book_authors_author"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9bf58ffb2a12a8609a738ee8ca" ON "book_authors_author" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a4cafdf2ec9974524a5321c751" ON "book_authors_author" ("authorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`, undefined);
|
||||
await queryRunner.query(
|
||||
`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"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_fictions_fiction"("bookId", "fictionId") SELECT "bookId", "fictionId" FROM "book_fictions_fiction"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_fictions_fiction"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_book_fictions_fiction" RENAME TO "book_fictions_fiction"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`, undefined);
|
||||
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"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_characters_character"("bookId", "characterId") SELECT "bookId", "characterId" FROM "book_characters_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_characters_character"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_book_characters_character" RENAME TO "book_characters_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_918a7b7552fe5fd66f328d4fe8"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5274aca0a1468ed55afdfaba24"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book_tags_tag" ("bookId" integer NOT NULL, "tagId" integer NOT NULL, CONSTRAINT "FK_918a7b7552fe5fd66f328d4fe84" FOREIGN KEY ("bookId") REFERENCES "book" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_5274aca0a1468ed55afdfaba244" FOREIGN KEY ("tagId") REFERENCES "tag" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("bookId", "tagId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book_tags_tag"("bookId", "tagId") SELECT "bookId", "tagId" FROM "book_tags_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book_tags_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_book_tags_tag" RENAME TO "book_tags_tag"`, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_918a7b7552fe5fd66f328d4fe8" ON "book_tags_tag" ("bookId") `, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_5274aca0a1468ed55afdfaba24" ON "book_tags_tag" ("tagId") `, undefined);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_5274aca0a1468ed55afdfaba24"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_918a7b7552fe5fd66f328d4fe8"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "book_tags_tag" RENAME TO "temporary_book_tags_tag"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_tags_tag" ("bookId" integer NOT NULL, "tagId" integer NOT NULL, PRIMARY KEY ("bookId", "tagId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_tags_tag"("bookId", "tagId") SELECT "bookId", "tagId" FROM "temporary_book_tags_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_tags_tag"`, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_5274aca0a1468ed55afdfaba24" ON "book_tags_tag" ("tagId") `, undefined);
|
||||
await queryRunner.query(`CREATE INDEX "IDX_918a7b7552fe5fd66f328d4fe8" ON "book_tags_tag" ("bookId") `, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "book_characters_character" RENAME TO "temporary_book_characters_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_characters_character" ("bookId" integer NOT NULL, "characterId" integer NOT NULL, PRIMARY KEY ("bookId", "characterId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_characters_character"("bookId", "characterId") SELECT "bookId", "characterId" FROM "temporary_book_characters_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_characters_character"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_51615a52cc3ef773766afbcc43" ON "book_characters_character" ("characterId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_261dcea7cb50a485906440f91f" ON "book_characters_character" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "book_fictions_fiction" RENAME TO "temporary_book_fictions_fiction"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_fictions_fiction" ("bookId" integer NOT NULL, "fictionId" integer NOT NULL, PRIMARY KEY ("bookId", "fictionId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_fictions_fiction"("bookId", "fictionId") SELECT "bookId", "fictionId" FROM "temporary_book_fictions_fiction"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_fictions_fiction"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_842bd3a8cb49dc7a92058b7f7a" ON "book_fictions_fiction" ("fictionId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_893dfbd84bd3a5a62e8a0758b3" ON "book_fictions_fiction" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a4cafdf2ec9974524a5321c751"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9bf58ffb2a12a8609a738ee8ca"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "book_authors_author" RENAME TO "temporary_book_authors_author"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_authors_author" ("bookId" integer NOT NULL, "authorId" integer NOT NULL, PRIMARY KEY ("bookId", "authorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_authors_author"("bookId", "authorId") SELECT "bookId", "authorId" FROM "temporary_book_authors_author"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_authors_author"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a4cafdf2ec9974524a5321c751" ON "book_authors_author" ("authorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9bf58ffb2a12a8609a738ee8ca" ON "book_authors_author" ("bookId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e19e5193f168ce07f52f15be06"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2a20d8eaf28ebc28438271899f"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "copy_translators_translator" RENAME TO "temporary_copy_translators_translator"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_translators_translator" ("copyId" integer NOT NULL, "translatorId" integer NOT NULL, PRIMARY KEY ("copyId", "translatorId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy_translators_translator"("copyId", "translatorId") SELECT "copyId", "translatorId" FROM "temporary_copy_translators_translator"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy_translators_translator"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e19e5193f168ce07f52f15be06" ON "copy_translators_translator" ("translatorId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2a20d8eaf28ebc28438271899f" ON "copy_translators_translator" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c6adacfab107dc725d4fb5864b"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_056de447bd9e4b2efdf5eafe49"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "copy_languages_language" RENAME TO "temporary_copy_languages_language"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_languages_language" ("copyId" integer NOT NULL, "languageId" integer NOT NULL, PRIMARY KEY ("copyId", "languageId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy_languages_language"("copyId", "languageId") SELECT "copyId", "languageId" FROM "temporary_copy_languages_language"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy_languages_language"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c6adacfab107dc725d4fb5864b" ON "copy_languages_language" ("languageId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_056de447bd9e4b2efdf5eafe49" ON "copy_languages_language" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_946af3644f779b7cc7e7eb04eb"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_653c33c5db26b8736e592ff3f6"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "copy_sources_source" RENAME TO "temporary_copy_sources_source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_sources_source" ("copyId" integer NOT NULL, "sourceId" integer NOT NULL, PRIMARY KEY ("copyId", "sourceId"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy_sources_source"("copyId", "sourceId") SELECT "copyId", "sourceId" FROM "temporary_copy_sources_source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy_sources_source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_946af3644f779b7cc7e7eb04eb" ON "copy_sources_source" ("sourceId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_653c33c5db26b8736e592ff3f6" ON "copy_sources_source" ("copyId") `,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "author_multi_name" RENAME TO "temporary_author_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_4d153aa4b33f8254933d224fe0" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "author_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_author_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_author_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "book_multi_name" RENAME TO "temporary_book_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_f989db6a159c4614d635ad6ad5" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_book_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "tag_multi_name" RENAME TO "temporary_tag_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_ab521dd46cf7699c4abf75b76b" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "tag_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_tag_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_tag_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "copy" RENAME TO "temporary_copy"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "rating" integer, "favorited" boolean NOT NULL DEFAULT (0), "isDigital" boolean NOT NULL, "originalId" integer NOT NULL, CONSTRAINT "CHK_f6e0d7b6b3e80ad96e2a1dda43" CHECK (rating >= 0 AND rating <= 9007199254740991))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy"("id", "rating", "favorited", "isDigital", "originalId") SELECT "id", "rating", "favorited", "isDigital", "originalId" FROM "temporary_copy"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "translator_multi_name" RENAME TO "temporary_translator_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "translator_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_0652150dacaf6454a4cd6811de" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "translator_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_translator_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_translator_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "source" RENAME TO "temporary_source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer NOT NULL, CONSTRAINT "UQ_028f4c3a05a9bfcddb95a4916b9" UNIQUE ("uri"))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "temporary_source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_source"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "site_multi_name" RENAME TO "temporary_site_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8dc8533fce07e041aa8474da05" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "site_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_site_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_site_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "copy_type" RENAME TO "temporary_copy_type"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "copy_type" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar NOT NULL, "comment" varchar, "copyId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy_type"("id", "type", "comment", "copyId") SELECT "id", "type", "comment", "copyId" FROM "temporary_copy_type"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy_type"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "character_multi_name" RENAME TO "temporary_character_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "character_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_8f6325928e3a0cc9b78b52f6dc" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "character_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_character_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_character_multi_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "fiction_multi_name" RENAME TO "temporary_fiction_multi_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "fiction_multi_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "multiNamedId" integer NOT NULL, CONSTRAINT "CHK_39f907c54d00784d2468156af2" CHECK (LENGTH(name) > 0))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "fiction_multi_name"("id", "name", "multiNamedId") SELECT "id", "name", "multiNamedId" FROM "temporary_fiction_multi_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_fiction_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5274aca0a1468ed55afdfaba24"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_918a7b7552fe5fd66f328d4fe8"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book_tags_tag"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51615a52cc3ef773766afbcc43"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_261dcea7cb50a485906440f91f"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book_characters_character"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_842bd3a8cb49dc7a92058b7f7a"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_893dfbd84bd3a5a62e8a0758b3"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book_fictions_fiction"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a4cafdf2ec9974524a5321c751"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9bf58ffb2a12a8609a738ee8ca"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book_authors_author"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e19e5193f168ce07f52f15be06"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2a20d8eaf28ebc28438271899f"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy_translators_translator"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c6adacfab107dc725d4fb5864b"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_056de447bd9e4b2efdf5eafe49"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy_languages_language"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_946af3644f779b7cc7e7eb04eb"`, undefined);
|
||||
await queryRunner.query(`DROP INDEX "IDX_653c33c5db26b8736e592ff3f6"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy_sources_source"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "book"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "tag_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "tag"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "translator_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "translator"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "source"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "site_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "site"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "language"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy_type"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "character_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "character"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "fiction_multi_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "fiction"`, undefined);
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class makeBooksUnrateable1575209413511 implements MigrationInterface {
|
||||
name = 'makeBooksUnrateable1575209413511';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "rating" integer, CONSTRAINT "CHK_bbef8dbd3571ec559f7a980fc5" CHECK ((LENGTH(nameCanonical) > 0)))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book"("id", "nameCanonical", "rating") SELECT "id", "nameCanonical", "rating" FROM "book"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_book" RENAME TO "book"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_book" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, CONSTRAINT "CHK_bbef8dbd3571ec559f7a980fc5" CHECK ((LENGTH(nameCanonical) > 0)))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_book"("id", "nameCanonical") SELECT "id", "nameCanonical" FROM "book"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "book"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_book" RENAME TO "book"`, undefined);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "book" RENAME TO "temporary_book"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "rating" integer, CONSTRAINT "CHK_bbef8dbd3571ec559f7a980fc5" CHECK ((LENGTH(nameCanonical) > 0)))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book"("id", "nameCanonical") SELECT "id", "nameCanonical" FROM "temporary_book"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "book" RENAME TO "temporary_book"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "book" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "rating" integer, CONSTRAINT "CHK_bbef8dbd3571ec559f7a980fc5" CHECK ((LENGTH(nameCanonical) > 0)), CONSTRAINT "CHK_62ebe0be1f2d31406118960aa5" CHECK ((rating >= 0 AND rating <= 9007199254740991)))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "book"("id", "nameCanonical", "rating") SELECT "id", "nameCanonical", "rating" FROM "temporary_book"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_book"`, undefined);
|
||||
}
|
||||
}
|
539
src/main/migrations/library/1586482961027-initial_migration.ts
Normal file
539
src/main/migrations/library/1586482961027-initial_migration.ts
Normal file
@ -0,0 +1,539 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class initialMigration1586482961027 implements MigrationInterface {
|
||||
name = 'initialMigration1586482961027';
|
||||
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_role" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "description" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "collection" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer)`,
|
||||
undefined
|
||||
);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`CREATE TABLE "language" ("code" varchar PRIMARY KEY NOT NULL)`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "description" varchar)`,
|
||||
undefined
|
||||
);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "workId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_author_role_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "author_role_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "author_role_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_author_role_name" RENAME TO "author_role_name"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_collection_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "collection_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "collection_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_collection_name" RENAME TO "collection_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_collection_part" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "order" integer NOT NULL DEFAULT (0), "collectionId" integer NOT NULL, "workId" integer NOT NULL, CONSTRAINT "FK_a331dfd7f97355b0241aabbe9dd" FOREIGN KEY ("collectionId") REFERENCES "collection" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_76bf2490e80346af774adb9f0f0" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_collection_part"("id", "order", "collectionId", "workId") SELECT "id", "order", "collectionId", "workId" FROM "collection_part"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "collection_part"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_collection_part" RENAME TO "collection_part"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_site_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "site_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "site_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_site_name" RENAME TO "site_name"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "source"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_source" RENAME TO "source"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_copy"("id", "hash", "location", "ranking", "originalId") SELECT "id", "hash", "location", "ranking", "originalId" FROM "copy"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "copy"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_copy" RENAME TO "copy"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_transformation_type_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "transformation_type_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "transformation_type_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "temporary_transformation_type_name" RENAME TO "transformation_type_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_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, CONSTRAINT "FK_263a368f9017f5725c4fa12351b" FOREIGN KEY ("byWorkId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_4deb36ce15d6547c1ed7e994720" FOREIGN KEY ("typeId") REFERENCES "transformation_type" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT "FK_d41fc0471e72b5d1dda372a662c" FOREIGN KEY ("ofWorkId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_transformation"("id", "order", "byWorkId", "typeId", "ofWorkId") SELECT "id", "order", "byWorkId", "typeId", "ofWorkId" FROM "transformation"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "transformation"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_transformation" RENAME TO "transformation"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_interaction_tag"("id", "weight", "tagId") SELECT "id", "weight", "tagId" FROM "interaction_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "interaction_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_interaction_tag" RENAME TO "interaction_tag"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_tag_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "tag_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "tag_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_tag_name" RENAME TO "tag_name"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_work_tag"("id", "weight", "tagId", "workId") SELECT "id", "weight", "tagId", "workId" FROM "work_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "work_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_work_tag" RENAME TO "work_tag"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_character_tag"("id", "weight", "workCharacterId", "tagId") SELECT "id", "weight", "workCharacterId", "tagId" FROM "character_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "character_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_character_tag" RENAME TO "character_tag"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_work_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "work_character_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "work_character_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_work_character_name" RENAME TO "work_character_name"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_world_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "world_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "world_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_world_name" RENAME TO "world_name"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_world_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "world_character_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "world_character_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_world_character_name" RENAME TO "world_character_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_work_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "workId" integer NOT NULL, CONSTRAINT "FK_bd63df77a1db7870038853da30f" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_work_character"("id", "nameCanonical", "workId") SELECT "id", "nameCanonical", "workId" FROM "work_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "work_character"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_work_character" RENAME TO "work_character"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_work_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "work_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "work_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_work_name" RENAME TO "work_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "temporary_work_author" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "order" integer NOT NULL DEFAULT (0), "workId" integer NOT NULL, "authorId" integer NOT NULL, CONSTRAINT "FK_661d8f5cdb4bd215ad16301e0b1" FOREIGN KEY ("workId") REFERENCES "work" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "FK_a2045b9fc41c357d2c98d5a9d60" FOREIGN KEY ("authorId") REFERENCES "author" ("id") ON DELETE RESTRICT ON UPDATE CASCADE)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_work_author"("id", "order", "workId", "authorId") SELECT "id", "order", "workId", "authorId" FROM "work_author"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "work_author"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_work_author" RENAME TO "work_author"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "temporary_author_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "author_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "author_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "temporary_author_name" RENAME TO "author_name"`, undefined);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "author_name" RENAME TO "temporary_author_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "author_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_author_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_author_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "work_author" RENAME TO "temporary_work_author"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "work_author"("id", "order", "workId", "authorId") SELECT "id", "order", "workId", "authorId" FROM "temporary_work_author"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_work_author"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "work_name" RENAME TO "temporary_work_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "work_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_work_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_work_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "work_character" RENAME TO "temporary_work_character"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_character" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "nameCanonical" varchar NOT NULL, "workId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "work_character"("id", "nameCanonical", "workId") SELECT "id", "nameCanonical", "workId" FROM "temporary_work_character"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_work_character"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "world_character_name" RENAME TO "temporary_world_character_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "world_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_world_character_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_world_character_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "world_name" RENAME TO "temporary_world_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "world_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "world_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_world_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_world_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "work_character_name" RENAME TO "temporary_work_character_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "work_character_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "work_character_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_work_character_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_work_character_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "character_tag" RENAME TO "temporary_character_tag"`, undefined);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "character_tag"("id", "weight", "workCharacterId", "tagId") SELECT "id", "weight", "workCharacterId", "tagId" FROM "temporary_character_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_character_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "work_tag" RENAME TO "temporary_work_tag"`, undefined);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "work_tag"("id", "weight", "tagId", "workId") SELECT "id", "weight", "tagId", "workId" FROM "temporary_work_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_work_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "tag_name" RENAME TO "temporary_tag_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "tag_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "tag_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_tag_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_tag_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "interaction_tag" RENAME TO "temporary_interaction_tag"`, undefined);
|
||||
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))`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "interaction_tag"("id", "weight", "tagId") SELECT "id", "weight", "tagId" FROM "temporary_interaction_tag"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_interaction_tag"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "transformation" RENAME TO "temporary_transformation"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "transformation"("id", "order", "byWorkId", "typeId", "ofWorkId") SELECT "id", "order", "byWorkId", "typeId", "ofWorkId" FROM "temporary_transformation"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_transformation"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transformation_type_name" RENAME TO "temporary_transformation_type_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "transformation_type_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "transformation_type_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_transformation_type_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_transformation_type_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "copy" RENAME TO "temporary_copy"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "copy"("id", "hash", "location", "ranking", "originalId") SELECT "id", "hash", "location", "ranking", "originalId" FROM "temporary_copy"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_copy"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "source" RENAME TO "temporary_source"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "source" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "uri" varchar NOT NULL, "siteId" integer)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "source"("id", "uri", "siteId") SELECT "id", "uri", "siteId" FROM "temporary_source"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_source"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "site_name" RENAME TO "temporary_site_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "site_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "site_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_site_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_site_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "collection_part" RENAME TO "temporary_collection_part"`, undefined);
|
||||
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)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "collection_part"("id", "order", "collectionId", "workId") SELECT "id", "order", "collectionId", "workId" FROM "temporary_collection_part"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_collection_part"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "collection_name" RENAME TO "temporary_collection_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "collection_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "collection_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_collection_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_collection_name"`, undefined);
|
||||
await queryRunner.query(`ALTER TABLE "author_role_name" RENAME TO "temporary_author_role_name"`, undefined);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "author_role_name" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "entityId" integer NOT NULL)`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(
|
||||
`INSERT INTO "author_role_name"("id", "name", "entityId") SELECT "id", "name", "entityId" FROM "temporary_author_role_name"`,
|
||||
undefined
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "temporary_author_role_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work_author"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work_character"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "world_character"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "world_character_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "world"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "world_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work_character_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "character_tag"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "tag"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "work_tag"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "tag_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "interaction_tag"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "transformation"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "transformation_type"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "transformation_type_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "language"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "copy"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "source"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "site"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "site_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "collection_part"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "collection"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "collection_name"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author_role"`, undefined);
|
||||
await queryRunner.query(`DROP TABLE "author_role_name"`, undefined);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user