Improved 'is new' postgres function to deal with skipped batch IDs.
This commit is contained in:
@@ -803,7 +803,7 @@ exports.up = knex => Promise.resolve()
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
|
||||
CREATE FUNCTION releases_is_new(release releases) RETURNS boolean AS $$
|
||||
SELECT NOT EXISTS(SELECT true FROM batches WHERE batches.id = release.created_batch_id + 1 LIMIT 1);
|
||||
SELECT EXISTS(SELECT true WHERE (SELECT id FROM batches ORDER BY created_at DESC LIMIT 1) = release.created_batch_id);
|
||||
$$ LANGUAGE sql STABLE;
|
||||
|
||||
CREATE VIEW movie_actors AS
|
||||
|
||||
Reference in New Issue
Block a user