Skip to content

Commit

Permalink
more bugfixed in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhnanda committed Nov 19, 2023
1 parent 12b5a06 commit d1dcb0f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/OddJobs/Migrations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ createJobTableQuery = "CREATE TABLE IF NOT EXISTS ?" <>
", locked_at timestamp with time zone null" <>
", locked_by text null" <>
", result jsonb" <>
", parent_job_id int references ?(id)" <>
", parent_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 All @@ -45,7 +45,7 @@ createJobTableQuery = "CREATE TABLE IF NOT EXISTS ?" <>
"create index if not exists ? on ?(locked_by);" <>
"create index if not exists ? on ?(status);" <>
"create index if not exists ? on ?(run_at);" <>
"create index if not exists ? on ?(parent_job_id);"
"create index if not exists ? on ?(parent_id);"

createNotificationTrigger :: Query
createNotificationTrigger = "create or replace function ?() returns trigger as $$" <>
Expand Down Expand Up @@ -78,7 +78,7 @@ createJobTable conn tname = void $ do
, tname
, PGS.Identifier $ "idx_" <> tnameTxt <> "_run_at"
, tname
, PGS.Identifier $ "idx_" <> tnameTxt <> "_parent_job_id"
, PGS.Identifier $ "idx_" <> tnameTxt <> "_parent_id"
, tname
)
_ <- PGS.execute conn createJobTableQuery args
Expand Down

0 comments on commit d1dcb0f

Please sign in to comment.