Added various tag photos and descriptions.

This commit is contained in:
DebaucheryLibrarian
2021-03-17 05:11:17 +01:00
parent 4e81a8a1d6
commit 5a2e93e900
48 changed files with 167 additions and 31 deletions

View File

@@ -1054,7 +1054,8 @@ exports.up = knex => Promise.resolve()
table.integer('user_id')
.references('id')
.inTable('users');
.inTable('users')
.onDelete('cascade');
table.string('name')
.notNullable();
@@ -1074,27 +1075,48 @@ exports.up = knex => Promise.resolve()
table.integer('stash_id')
.notNullable()
.references('id')
.inTable('stashes');
.inTable('stashes')
.onDelete('cascade');
table.integer('scene_id')
.notNullable()
.references('id')
.inTable('releases');
.inTable('releases')
.onDelete('cascade');
table.unique(['stash_id', 'scene_id']);
table.string('comment');
}))
.then(() => knex.schema.createTable('stashes_movies', (table) => {
table.integer('stash_id')
.notNullable()
.references('id')
.inTable('stashes')
.onDelete('cascade');
table.integer('movie_id')
.notNullable()
.references('id')
.inTable('movies')
.onDelete('cascade');
table.unique(['stash_id', 'movie_id']);
table.string('comment');
}))
.then(() => knex.schema.createTable('stashes_actors', (table) => {
table.integer('stash_id')
.notNullable()
.references('id')
.inTable('stashes');
.inTable('stashes')
.onDelete('cascade');
table.integer('actor_id')
.notNullable()
.references('id')
.inTable('actors');
.inTable('actors')
.onDelete('cascade');
table.unique(['stash_id', 'actor_id']);
@@ -1304,6 +1326,7 @@ exports.up = knex => Promise.resolve()
ALTER TABLE stashes ENABLE ROW LEVEL SECURITY;
ALTER TABLE stashes_scenes ENABLE ROW LEVEL SECURITY;
ALTER TABLE stashes_movies ENABLE ROW LEVEL SECURITY;
ALTER TABLE stashes_actors ENABLE ROW LEVEL SECURITY;
CREATE POLICY stashes_policy_select ON stashes FOR SELECT USING (stashes.public OR stashes.user_id = current_user_id());
@@ -1319,6 +1342,14 @@ exports.up = knex => Promise.resolve()
AND (stashes.user_id = current_user_id() OR stashes.public)
));
CREATE POLICY stashes_policy ON stashes_movies
USING (EXISTS (
SELECT *
FROM stashes
WHERE stashes.id = stashes_movies.stash_id
AND (stashes.user_id = current_user_id() OR stashes.public)
));
CREATE POLICY stashes_policy ON stashes_actors
USING (EXISTS (
SELECT *
@@ -1416,6 +1447,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP TABLE IF EXISTS entities CASCADE;
DROP TABLE IF EXISTS stashes_scenes CASCADE;
DROP TABLE IF EXISTS stashes_movies CASCADE;
DROP TABLE IF EXISTS stashes_actors CASCADE;
DROP TABLE IF EXISTS stashes CASCADE;