Added alert dialog. Fixed image rotation EXIT data being discarded.

This commit is contained in:
DebaucheryLibrarian
2021-04-04 21:52:19 +02:00
parent 837fc98ad2
commit da0cbced15
43 changed files with 1134 additions and 38 deletions

View File

@@ -1138,6 +1138,114 @@ exports.up = knex => Promise.resolve()
.notNullable()
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('alerts', (table) => {
table.increments('id');
table.integer('user_id')
.references('id')
.inTable('users')
.onDelete('cascade');
table.boolean('notify')
.defaultTo(false);
table.boolean('email')
.defaultTo(false);
table.integer('stash_id')
.references('id')
.inTable('stashes')
.onDelete('cascade');
table.datetime('created_at')
.notNullable()
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('alerts_scenes', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('scene_id')
.notNullable()
.references('id')
.inTable('releases')
.onDelete('cascade');
table.unique(['alert_id', 'scene_id']);
}))
.then(() => knex.schema.createTable('alerts_actors', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('actor_id')
.notNullable()
.references('id')
.inTable('actors')
.onDelete('cascade');
table.unique(['alert_id', 'actor_id']);
}))
.then(() => knex.schema.createTable('alerts_tags', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('tag_id')
.notNullable()
.references('id')
.inTable('tags')
.onDelete('cascade');
table.unique(['alert_id', 'tag_id']);
}))
.then(() => knex.schema.createTable('alerts_entities', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('entity_id')
.notNullable()
.references('id')
.inTable('entities')
.onDelete('cascade');
table.unique(['alert_id', 'entity_id']);
}))
.then(() => knex.schema.createTable('alerts_stashes', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('stash_id')
.notNullable()
.references('id')
.inTable('stashes')
.onDelete('cascade');
table.unique(['stash_id', 'entity_id']);
}))
// SEARCH
.then(() => { // eslint-disable-line arrow-body-style
// allow vim fold
@@ -1192,12 +1300,23 @@ exports.up = knex => Promise.resolve()
url ILIKE ('%' || search || '%')
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION search_actors(search text, min_length numeric DEFAULT 2) RETURNS SETOF actors AS $$
CREATE FUNCTION search_actors(search text, min_length smallint DEFAULT 2) RETURNS SETOF actors AS $$
SELECT * FROM actors
WHERE length(search) >= min_length
AND name ILIKE ('%' || TRIM(search) || '%')
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION search_tags(search text, min_length smallint DEFAULT 2, is_primary boolean DEFAULT true) RETURNS SETOF tags AS $$
SELECT * FROM tags
WHERE length(search) >= min_length
AND name ILIKE ('%' || TRIM(search) || '%')
AND CASE
WHEN is_primary
THEN tags.alias_for IS NULL
ELSE true
END
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION actors_tags(actor actors, selectable_tags text[]) RETURNS SETOF tags AS $$
SELECT tags.*
FROM releases_actors
@@ -1398,6 +1517,8 @@ exports.up = knex => Promise.resolve()
COMMENT ON FUNCTION actors_scenes IS E'@sortable';
COMMENT ON FUNCTION tags_scenes IS E'@sortable';
COMMENT ON FUNCTION search_releases IS E'@sortable';
COMMENT ON FUNCTION search_actors IS E'@sortable';
COMMENT ON FUNCTION search_tags IS E'@sortable';
`);
});
@@ -1468,6 +1589,13 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP TABLE IF EXISTS stashes_actors CASCADE;
DROP TABLE IF EXISTS stashes CASCADE;
DROP TABLE IF EXISTS alerts_scenes CASCADE;
DROP TABLE IF EXISTS alerts_actors CASCADE;
DROP TABLE IF EXISTS alerts_tags CASCADE;
DROP TABLE IF EXISTS alerts_entities CASCADE;
DROP TABLE IF EXISTS alerts_stashes CASCADE;
DROP TABLE IF EXISTS alerts CASCADE;
DROP TABLE IF EXISTS users CASCADE;
DROP TABLE IF EXISTS users_roles CASCADE;
@@ -1475,6 +1603,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP FUNCTION IF EXISTS search_sites;
DROP FUNCTION IF EXISTS search_entities;
DROP FUNCTION IF EXISTS search_actors;
DROP FUNCTION IF EXISTS search_tags;
DROP FUNCTION IF EXISTS get_random_sfw_media_id;
DROP FUNCTION IF EXISTS releases_is_new;