Ignore delay when first migration was < 10min ago

This commit is contained in:
Gerhard Schlager
2018-03-26 16:51:27 +02:00
committed by Sam
parent cd17f60952
commit 4ad401bac5
3 changed files with 226 additions and 88 deletions

View File

@ -33,7 +33,12 @@ module Migration
SELECT 1
FROM schema_migration_details
WHERE name = :after_migration AND
created_at <= (current_timestamp AT TIME ZONE 'UTC' - INTERVAL :delay)
(created_at <= (current_timestamp AT TIME ZONE 'UTC' - INTERVAL :delay) OR
(SELECT created_at
FROM schema_migration_details
ORDER BY id ASC
LIMIT 1) > (current_timestamp AT TIME ZONE 'UTC' - INTERVAL '10 minutes')
)
)
SQL
end