Skip to content

Commit

Permalink
bugfix in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhnanda committed Nov 19, 2023
1 parent 5811ee1 commit 12b5a06
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/OddJobs/Migrations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ createJobTableQuery = "CREATE TABLE IF NOT EXISTS ?" <>
", attempts int not null default 0" <>
", locked_at timestamp with time zone null" <>
", locked_by text null" <>
", result jsonb, parent_job_id int references ?(id)" <>
", result jsonb" <>
", parent_job_id int references ?(id)" <>
", constraint incorrect_locking_info CHECK (" <>
"(locked_at is null and locked_by is null and status <> 'locked') or " <>
"(locked_at is not null and locked_by is not null and (status = 'locked' or status = 'cancelled')))" <>
Expand Down Expand Up @@ -77,8 +78,8 @@ createJobTable conn tname = void $ do
, tname
, PGS.Identifier $ "idx_" <> tnameTxt <> "_run_at"
, tname
, tname
, PGS.Identifier $ "idx_" <> tnameTxt <> "_parent_job_id"
, tname
)
_ <- PGS.execute conn createJobTableQuery args
PGS.execute conn createNotificationTrigger
Expand Down

0 comments on commit 12b5a06

Please sign in to comment.