2024-01-25 00:58:55 +00:00
|
|
|
const config = require('config');
|
|
|
|
const manticore = require('manticoresearch');
|
|
|
|
|
|
|
|
const mantiClient = new manticore.ApiClient();
|
|
|
|
|
|
|
|
mantiClient.basePath = `http://${config.database.manticore.host}:${config.database.manticore.httpPort}`;
|
|
|
|
|
|
|
|
const utilsApi = new manticore.UtilsApi(mantiClient);
|
|
|
|
|
2024-03-14 23:57:28 +00:00
|
|
|
const scenesFields = `
|
|
|
|
id int,
|
|
|
|
title text,
|
|
|
|
title_filtered text,
|
|
|
|
shoot_id text,
|
|
|
|
channel_id int,
|
|
|
|
channel_name text,
|
|
|
|
channel_slug text,
|
|
|
|
network_id int,
|
|
|
|
network_name text,
|
|
|
|
network_slug text,
|
2024-09-03 04:10:08 +00:00
|
|
|
studio_id int,
|
|
|
|
studio_name text,
|
|
|
|
studio_slug text,
|
2024-03-24 21:16:58 +00:00
|
|
|
entity_ids multi,
|
2024-03-14 23:57:28 +00:00
|
|
|
actor_ids multi,
|
|
|
|
actors text,
|
|
|
|
tag_ids multi,
|
|
|
|
tags text,
|
2024-06-01 22:28:42 +00:00
|
|
|
movie_ids multi,
|
2024-08-29 02:46:21 +00:00
|
|
|
movies text,
|
2024-06-01 22:28:42 +00:00
|
|
|
serie_ids multi,
|
2024-08-29 02:46:21 +00:00
|
|
|
series text,
|
2024-03-14 23:57:28 +00:00
|
|
|
meta text,
|
|
|
|
date timestamp,
|
2024-03-17 02:57:55 +00:00
|
|
|
is_showcased bool,
|
2024-03-14 23:57:28 +00:00
|
|
|
created_at timestamp,
|
|
|
|
effective_date timestamp,
|
2024-11-05 03:00:25 +00:00
|
|
|
stashed int,
|
|
|
|
dupe_index int
|
2024-03-14 23:57:28 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
const moviesFields = `
|
|
|
|
id int,
|
|
|
|
title text,
|
|
|
|
title_filtered text,
|
|
|
|
channel_id int,
|
|
|
|
channel_name text,
|
|
|
|
channel_slug text,
|
|
|
|
network_id int,
|
|
|
|
network_name text,
|
|
|
|
network_slug text,
|
2024-03-25 01:08:54 +00:00
|
|
|
entity_ids multi,
|
2024-03-14 23:57:28 +00:00
|
|
|
actor_ids multi,
|
|
|
|
actors text,
|
|
|
|
tag_ids multi,
|
|
|
|
tags text,
|
|
|
|
meta text,
|
|
|
|
date timestamp,
|
|
|
|
has_cover bool,
|
|
|
|
created_at timestamp,
|
|
|
|
effective_date timestamp,
|
|
|
|
stashed int,
|
|
|
|
stashed_scenes int,
|
2024-11-05 03:00:25 +00:00
|
|
|
stashed_total int,
|
|
|
|
dupe_index int
|
2024-03-14 23:57:28 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
const actorsFields = `
|
|
|
|
id int,
|
|
|
|
name text,
|
|
|
|
slug string,
|
|
|
|
gender string,
|
|
|
|
date_of_birth timestamp,
|
|
|
|
country string,
|
|
|
|
has_avatar bool,
|
2024-03-24 03:23:55 +00:00
|
|
|
mass int,
|
2024-03-14 23:57:28 +00:00
|
|
|
height int,
|
|
|
|
cup string,
|
|
|
|
natural_boobs int,
|
|
|
|
penis_length int,
|
|
|
|
penis_girth int,
|
|
|
|
stashed int,
|
|
|
|
scenes int
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports.up = async (knex) => {
|
2024-03-17 02:57:55 +00:00
|
|
|
try {
|
|
|
|
await utilsApi.sql(`create table scenes (${scenesFields})`);
|
|
|
|
|
|
|
|
await utilsApi.sql(`create table scenes_stashed (
|
|
|
|
scene_id int,
|
|
|
|
stash_id int,
|
|
|
|
user_id int,
|
|
|
|
created_at timestamp
|
|
|
|
)`);
|
|
|
|
|
|
|
|
await utilsApi.sql(`create table movies (${moviesFields})`);
|
|
|
|
|
|
|
|
await utilsApi.sql(`create table movies_stashed (
|
|
|
|
movie_id int,
|
|
|
|
stash_id int,
|
|
|
|
user_id int,
|
|
|
|
created_at timestamp
|
|
|
|
)`);
|
|
|
|
|
2024-05-30 21:54:49 +00:00
|
|
|
await utilsApi.sql(`create table actors (${actorsFields}) min_prefix_len='3'`);
|
2024-03-17 02:57:55 +00:00
|
|
|
|
|
|
|
await utilsApi.sql(`create table actors_stashed (
|
|
|
|
actor_id int,
|
|
|
|
stash_id int,
|
|
|
|
user_id int,
|
|
|
|
created_at timestamp
|
|
|
|
)`);
|
|
|
|
|
|
|
|
await knex.schema.alterTable('stashes_scenes', (table) => table.increments('id'));
|
|
|
|
await knex.schema.alterTable('stashes_movies', (table) => table.increments('id'));
|
|
|
|
await knex.schema.alterTable('stashes_actors', (table) => table.increments('id'));
|
|
|
|
await knex.schema.alterTable('stashes_series', (table) => table.increments('id'));
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
}
|
2024-01-25 00:58:55 +00:00
|
|
|
};
|
|
|
|
|
2024-03-14 23:57:28 +00:00
|
|
|
exports.down = async (knex) => {
|
|
|
|
await utilsApi.sql('drop table if exists scenes');
|
|
|
|
await utilsApi.sql('drop table if exists scenes_stashed');
|
|
|
|
await utilsApi.sql('drop table if exists movies');
|
|
|
|
await utilsApi.sql('drop table if exists movies_stashed');
|
|
|
|
await utilsApi.sql('drop table if exists actors');
|
|
|
|
await utilsApi.sql('drop table if exists actors_stashed');
|
|
|
|
|
|
|
|
await knex.schema.alterTable('stashes_scenes', (table) => table.dropColumn('id'));
|
|
|
|
await knex.schema.alterTable('stashes_movies', (table) => table.dropColumn('id'));
|
|
|
|
await knex.schema.alterTable('stashes_actors', (table) => table.dropColumn('id'));
|
|
|
|
await knex.schema.alterTable('stashes_series', (table) => table.dropColumn('id'));
|
2024-01-25 00:58:55 +00:00
|
|
|
};
|