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-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,
|
|
|
|
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,
|
|
|
|
stashed int
|
|
|
|
`;
|
|
|
|
|
|
|
|
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,
|
|
|
|
stashed_total int
|
|
|
|
`;
|
|
|
|
|
|
|
|
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
|
|
|
};
|