mirror of
https://github.com/sakaljurgis/kodi-api-server.git
synced 2026-07-08 20:37:41 +00:00
migrations; torr search, dl, seed, delete; files scan, delete; configs
This commit is contained in:
@@ -5,36 +5,44 @@ export class CreateFilesTable1672729641013 implements MigrationInterface {
|
||||
await queryRunner.query(
|
||||
`create table files
|
||||
(
|
||||
id INTEGER
|
||||
id INTEGER
|
||||
primary key autoincrement,
|
||||
path VARCHAR(512),
|
||||
deleted TINYINT,
|
||||
size INTEGER,
|
||||
file_name VARCHAR(512),
|
||||
infos TEXT,
|
||||
info TEXT,
|
||||
title_id INTEGER,
|
||||
season INTEGER default NULL,
|
||||
duration REAL,
|
||||
transmission INTEGER default NULL,
|
||||
lm INTEGER default NULL
|
||||
path VARCHAR(512),
|
||||
relative_path TEXT,
|
||||
deleted TINYINT,
|
||||
size INTEGER,
|
||||
file_name VARCHAR(512),
|
||||
infos TEXT,
|
||||
info TEXT,
|
||||
title_id INTEGER,
|
||||
season INTEGER default NULL,
|
||||
duration REAL,
|
||||
transmission_id INTEGER default NULL,
|
||||
linkomanija INTEGER default NULL,
|
||||
progress REAL,
|
||||
stream_provider TEXT default 'fs' not null
|
||||
);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create unique index path
|
||||
`create unique index files_path
|
||||
on files (path);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create index season
|
||||
`create index files_season
|
||||
on files (season);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create index title_id
|
||||
`create index files_title_id
|
||||
on files (title_id);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create index files_relative_path
|
||||
on files (relative_path);`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
|
||||
@@ -7,8 +7,11 @@ export class CreateLrtCategoriesTable1672730402752
|
||||
await queryRunner.query(
|
||||
`create table lrt_categories
|
||||
(
|
||||
category_url TEXT,
|
||||
category_id TEXT
|
||||
category_url VARCHAR(256),
|
||||
category_id INTEGER,
|
||||
title VARCHAR(128),
|
||||
last_access TIMESTAMP,
|
||||
thumb VARCHAR(256)
|
||||
);`,
|
||||
);
|
||||
|
||||
@@ -16,6 +19,11 @@ export class CreateLrtCategoriesTable1672730402752
|
||||
`create index lrt_categories_category_url_index
|
||||
on lrt_categories (category_url);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create index lrt_categories_category_id
|
||||
on lrt_categories (category_id);`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddStreamProviderColumnToFilesTable1672820632908
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
add stream_provider TEXT default 'fs' not null;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
drop column stream_provider;`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddRelativePathColumnToFilesTable1672990196772
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
add relative_path TEXT;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
drop column relative_path;`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class RenameLinkomanijaColumnInFilesTable1673010469305
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE files RENAME COLUMN lm to linkomanija;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE files RENAME COLUMN linkomanija to lm;`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddWebtorrentColumnsToFilesTable1673010885172
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
add webtorrent INTEGER;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
drop column webtorrent;`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class CreateTorrentsTableAndRelateToFiles1673603746273
|
||||
implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
add torrent_id INTEGER;`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create unique index file_torrent_id
|
||||
on files (torrent_id);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create table torrents
|
||||
(
|
||||
id INTEGER primary key,
|
||||
magnet VARCHAR(512),
|
||||
name VARCHAR(256),
|
||||
path VARCHAR(512),
|
||||
size INTEGER,
|
||||
stopped TINYINT,
|
||||
info_hash VARCHAR(64),
|
||||
progress REAL,
|
||||
transmission_id INTEGER,
|
||||
info TEXT
|
||||
);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create unique index torrent_magnet
|
||||
on torrents (magnet);`,
|
||||
);
|
||||
|
||||
await queryRunner.query(
|
||||
`create unique index torrent_transmission_id
|
||||
on torrents (transmission_id);`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`alter table files
|
||||
drop column torrent_id;`,
|
||||
);
|
||||
|
||||
await queryRunner.query(`DROP TABLE torrents`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user