2019-03-25 02:57:33 +00:00
|
|
|
exports.up = knex => Promise.resolve()
|
|
|
|
.then(() => knex.schema.createTable('actors', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-03-25 02:57:33 +00:00
|
|
|
|
2019-05-06 00:01:57 +00:00
|
|
|
table.string('name')
|
|
|
|
.unique()
|
|
|
|
.notNullable();
|
2019-11-10 03:20:22 +00:00
|
|
|
|
2019-04-06 21:24:26 +00:00
|
|
|
table.string('gender', 18);
|
2019-11-10 03:20:22 +00:00
|
|
|
table.text('description');
|
|
|
|
table.date('birthdate');
|
|
|
|
table.string('ethnicity');
|
|
|
|
table.string('country_alpha2', 2);
|
|
|
|
table.string('city');
|
|
|
|
table.integer('height');
|
|
|
|
table.string('boobs_size');
|
|
|
|
table.boolean('boobs_natural');
|
2019-04-06 21:24:26 +00:00
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('alias_for', 12)
|
2019-03-25 02:57:33 +00:00
|
|
|
.references('id')
|
|
|
|
.inTable('actors');
|
2019-07-06 03:29:12 +00:00
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-03-25 02:57:33 +00:00
|
|
|
}))
|
2019-04-04 02:00:28 +00:00
|
|
|
.then(() => knex.schema.createTable('directors', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-04-04 02:00:28 +00:00
|
|
|
|
|
|
|
table.string('name');
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('alias_for', 12)
|
2019-04-04 02:00:28 +00:00
|
|
|
.references('id')
|
|
|
|
.inTable('directors');
|
2019-07-06 03:29:12 +00:00
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-04-04 02:00:28 +00:00
|
|
|
}))
|
2019-04-07 00:15:57 +00:00
|
|
|
.then(() => knex.schema.createTable('tags_groups', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-04-07 00:15:57 +00:00
|
|
|
|
2019-11-11 04:18:28 +00:00
|
|
|
table.string('name', 32);
|
|
|
|
table.text('description');
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-04-07 00:15:57 +00:00
|
|
|
}))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.createTable('tags', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-10-27 23:58:54 +00:00
|
|
|
table.string('name');
|
2019-05-06 00:01:57 +00:00
|
|
|
|
2019-11-11 04:18:28 +00:00
|
|
|
table.text('description');
|
|
|
|
|
2019-11-12 00:22:20 +00:00
|
|
|
table.integer('priority', 2)
|
|
|
|
.defaultTo(0);
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('group_id', 12)
|
|
|
|
.references('id')
|
2019-04-07 00:15:57 +00:00
|
|
|
.inTable('tags_groups');
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('alias_for', 12)
|
|
|
|
.references('id')
|
2019-03-25 02:57:33 +00:00
|
|
|
.inTable('tags');
|
2019-09-08 01:53:09 +00:00
|
|
|
|
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-03-25 02:57:33 +00:00
|
|
|
}))
|
|
|
|
.then(() => knex.schema.createTable('networks', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-03-25 02:57:33 +00:00
|
|
|
|
|
|
|
table.string('name');
|
|
|
|
table.string('url');
|
2019-05-06 00:01:57 +00:00
|
|
|
table.text('description');
|
2019-11-04 04:47:37 +00:00
|
|
|
table.string('parameters');
|
2019-09-08 01:53:09 +00:00
|
|
|
|
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-03-25 02:57:33 +00:00
|
|
|
}))
|
|
|
|
.then(() => knex.schema.createTable('sites', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 12);
|
2019-03-25 02:57:33 +00:00
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('network_id', 12)
|
2019-03-25 02:57:33 +00:00
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('networks');
|
|
|
|
|
|
|
|
table.string('name');
|
|
|
|
table.string('url');
|
2019-05-06 00:01:57 +00:00
|
|
|
table.text('description');
|
2019-03-26 00:26:47 +00:00
|
|
|
table.string('parameters');
|
2019-09-08 01:53:09 +00:00
|
|
|
|
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-03-25 02:57:33 +00:00
|
|
|
}))
|
2019-10-30 03:45:42 +00:00
|
|
|
.then(() => knex.schema.createTable('studios', (table) => {
|
|
|
|
table.increments('id', 12);
|
|
|
|
|
|
|
|
table.integer('network_id', 12)
|
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('networks');
|
|
|
|
|
|
|
|
table.string('name');
|
|
|
|
table.string('url');
|
|
|
|
table.text('description');
|
|
|
|
|
|
|
|
table.string('slug', 32)
|
|
|
|
.unique();
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-10-30 03:45:42 +00:00
|
|
|
}))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.createTable('releases', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.increments('id', 16);
|
2019-03-25 02:57:33 +00:00
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('site_id', 12)
|
2019-03-25 02:57:33 +00:00
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('sites');
|
|
|
|
|
2019-10-30 03:45:42 +00:00
|
|
|
table.integer('studio_id', 12)
|
|
|
|
.references('id')
|
|
|
|
.inTable('studios');
|
|
|
|
|
2019-03-25 02:57:33 +00:00
|
|
|
table.string('shoot_id');
|
2019-04-06 21:24:26 +00:00
|
|
|
table.string('entry_id');
|
2019-04-01 00:45:15 +00:00
|
|
|
table.unique(['site_id', 'shoot_id']);
|
2019-04-06 21:24:26 +00:00
|
|
|
table.unique(['site_id', 'entry_id']);
|
2019-04-01 00:45:15 +00:00
|
|
|
|
2019-11-12 00:22:20 +00:00
|
|
|
table.string('url', 1000);
|
2019-03-25 02:57:33 +00:00
|
|
|
table.string('title');
|
|
|
|
table.date('date');
|
|
|
|
table.text('description');
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('director', 12)
|
2019-04-04 02:00:28 +00:00
|
|
|
.references('id')
|
|
|
|
.inTable('directors');
|
|
|
|
|
2019-03-25 02:57:33 +00:00
|
|
|
table.integer('duration')
|
|
|
|
.unsigned();
|
|
|
|
|
|
|
|
table.integer('likes')
|
|
|
|
.unsigned();
|
|
|
|
|
|
|
|
table.integer('dislikes')
|
|
|
|
.unsigned();
|
|
|
|
|
2019-11-09 00:22:50 +00:00
|
|
|
table.float('rating', 2)
|
2019-03-25 02:57:33 +00:00
|
|
|
.unsigned();
|
2019-05-06 00:01:57 +00:00
|
|
|
|
2019-09-26 01:27:01 +00:00
|
|
|
table.boolean('deep');
|
|
|
|
|
2019-05-06 00:01:57 +00:00
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-03-25 02:57:33 +00:00
|
|
|
}))
|
2019-09-08 01:53:09 +00:00
|
|
|
.then(() => knex.schema.createTable('media', (table) => {
|
|
|
|
table.increments('id', 16);
|
|
|
|
|
2019-09-25 02:52:58 +00:00
|
|
|
table.string('path');
|
2019-11-11 02:20:00 +00:00
|
|
|
table.string('thumbnail');
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('index');
|
|
|
|
table.string('mime');
|
|
|
|
|
2019-11-12 00:22:20 +00:00
|
|
|
table.string('domain');
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('target_id', 16);
|
|
|
|
|
2019-11-12 00:22:20 +00:00
|
|
|
table.string('role');
|
2019-09-25 02:52:58 +00:00
|
|
|
table.string('quality', 6);
|
2019-11-12 00:22:20 +00:00
|
|
|
|
|
|
|
table.string('hash');
|
|
|
|
table.string('source', 1000);
|
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.defaultTo(knex.fn.now());
|
2019-09-08 01:53:09 +00:00
|
|
|
}))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.createTable('actors_associated', (table) => {
|
|
|
|
table.increments('id', 16);
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('release_id', 16)
|
2019-03-25 02:57:33 +00:00
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('releases');
|
|
|
|
|
|
|
|
table.integer('actor_id', 8)
|
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('actors');
|
|
|
|
}))
|
2019-07-06 03:29:12 +00:00
|
|
|
.then(() => knex.schema.createTable('directors_associated', (table) => {
|
|
|
|
table.increments('id', 16);
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('release_id', 16)
|
2019-07-06 03:29:12 +00:00
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('releases');
|
|
|
|
|
|
|
|
table.integer('director_id', 8)
|
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
|
|
|
.inTable('directors');
|
|
|
|
}))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.createTable('tags_associated', (table) => {
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('tag_id', 12)
|
2019-03-25 02:57:33 +00:00
|
|
|
.notNullable()
|
2019-09-08 01:53:09 +00:00
|
|
|
.references('id')
|
2019-03-25 02:57:33 +00:00
|
|
|
.inTable('tags');
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('site_id', 12)
|
2019-03-25 02:57:33 +00:00
|
|
|
.references('id')
|
|
|
|
.inTable('sites');
|
|
|
|
|
2019-09-08 01:53:09 +00:00
|
|
|
table.integer('release_id', 16)
|
2019-03-25 02:57:33 +00:00
|
|
|
.references('id')
|
|
|
|
.inTable('releases');
|
|
|
|
}));
|
|
|
|
|
|
|
|
exports.down = knex => Promise.resolve()
|
|
|
|
.then(() => knex.schema.dropTable('tags_associated'))
|
2019-07-06 03:29:12 +00:00
|
|
|
.then(() => knex.schema.dropTable('directors_associated'))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.dropTable('actors_associated'))
|
2019-05-06 00:01:57 +00:00
|
|
|
.then(() => knex.schema.dropTable('tags'))
|
|
|
|
.then(() => knex.schema.dropTable('tags_groups'))
|
2019-09-08 01:53:09 +00:00
|
|
|
.then(() => knex.schema.dropTable('media'))
|
2019-05-06 00:01:57 +00:00
|
|
|
.then(() => knex.schema.dropTable('actors'))
|
2019-03-25 02:57:33 +00:00
|
|
|
.then(() => knex.schema.dropTable('releases'))
|
|
|
|
.then(() => knex.schema.dropTable('sites'))
|
2019-10-30 03:45:42 +00:00
|
|
|
.then(() => knex.schema.dropTable('studios'))
|
2019-04-06 21:24:26 +00:00
|
|
|
.then(() => knex.schema.dropTable('directors'))
|
2019-05-06 00:01:57 +00:00
|
|
|
.then(() => knex.schema.dropTable('networks'));
|