Added rudimentary affiliate banner setup. Separated login and signup disable. Added various tag photos.
This commit is contained in:
@@ -1274,6 +1274,83 @@ exports.up = knex => Promise.resolve()
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
}))
|
||||
.then(() => knex.schema.createTable('affiliates', (table) => {
|
||||
table.string('id')
|
||||
.primary()
|
||||
.unique()
|
||||
.notNullable();
|
||||
|
||||
table.text('url')
|
||||
.notNullable();
|
||||
|
||||
table.text('comment');
|
||||
|
||||
table.datetime('created_at')
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
}))
|
||||
.then(() => knex.schema.createTable('banners', (table) => {
|
||||
table.string('id')
|
||||
.primary()
|
||||
.unique()
|
||||
.notNullable();
|
||||
|
||||
table.integer('width')
|
||||
.notNullable();
|
||||
|
||||
table.integer('height')
|
||||
.notNullable();
|
||||
|
||||
table.integer('entity_id', 12)
|
||||
.references('id')
|
||||
.inTable('entities');
|
||||
|
||||
table.text('comment');
|
||||
|
||||
table.datetime('created_at')
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
}))
|
||||
.then(() => knex.schema.createTable('banners_tags', (table) => {
|
||||
table.increments('id');
|
||||
|
||||
table.string('banner_id')
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('banners');
|
||||
|
||||
table.integer('tag_id')
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('tags');
|
||||
|
||||
table.unique(['banner_id', 'tag_id']);
|
||||
|
||||
table.datetime('created_at')
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
}))
|
||||
.then(() => knex.schema.createTable('campaigns', (table) => {
|
||||
table.increments('id');
|
||||
|
||||
table.integer('entity_id', 12)
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('entities');
|
||||
|
||||
table.string('affiliate_id')
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('affiliates');
|
||||
|
||||
table.string('banner_id')
|
||||
.references('id')
|
||||
.inTable('banners');
|
||||
|
||||
table.datetime('created_at')
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
}))
|
||||
// SEARCH AND SORT
|
||||
.then(() => { // eslint-disable-line arrow-body-style
|
||||
// allow vim fold
|
||||
@@ -1293,6 +1370,9 @@ exports.up = knex => Promise.resolve()
|
||||
CREATE UNIQUE INDEX unique_actor_slugs_network ON actors (slug, entity_id, entry_id);
|
||||
CREATE UNIQUE INDEX unique_actor_slugs ON actors (slug) WHERE entity_id IS NULL;
|
||||
|
||||
CREATE UNIQUE INDEX unique_entity_campaigns_banner ON campaigns (entity_id, affiliate_id, banner_id);
|
||||
CREATE UNIQUE INDEX unique_entity_campaigns ON campaigns (entity_id, affiliate_id) WHERE banner_id IS NULL;
|
||||
|
||||
CREATE UNIQUE INDEX releases_search_unique ON releases_search (release_id);
|
||||
CREATE INDEX releases_search_index ON releases_search USING GIN (document);
|
||||
`);
|
||||
@@ -1647,6 +1727,10 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
|
||||
DROP TABLE IF EXISTS chapters_posters CASCADE;
|
||||
DROP TABLE IF EXISTS chapters_photos CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS banners_tags CASCADE;
|
||||
DROP TABLE IF EXISTS banners CASCADE;
|
||||
DROP TABLE IF EXISTS affiliates CASCADE;
|
||||
DROP TABLE IF EXISTS campaigns CASCADE;
|
||||
DROP TABLE IF EXISTS batches CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS actors_avatars CASCADE;
|
||||
@@ -1659,6 +1743,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
|
||||
|
||||
DROP TABLE IF EXISTS entities_tags CASCADE;
|
||||
DROP TABLE IF EXISTS entities_social CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS sites_tags CASCADE;
|
||||
DROP TABLE IF EXISTS sites_social CASCADE;
|
||||
DROP TABLE IF EXISTS networks_social CASCADE;
|
||||
|
||||
Reference in New Issue
Block a user