diff --git a/src/Database.fs b/src/Database.fs index cae6962..44aa5c3 100644 --- a/src/Database.fs +++ b/src/Database.fs @@ -50,13 +50,16 @@ let make (logger: ILogger) = use listen = new NpgsqlCommand ("LISTEN bidello_database_update;", conn) listen.ExecuteNonQuery () |> ignore + logger.Information "Successfully connected to the database." + {connection = conn} let wait_notification (ct: CancellationToken) (db: t) = db.connection.WaitAsync ct -type Requirements_ = { +[] +type Requirements = { job_name: string ``when``: string executable: string @@ -86,4 +89,4 @@ group by c.job_name, h.hostname """ new CommandDefinition (query, parameters=param, transaction=null, commandTimeout=nl, commandType=cl, flags=CommandFlags.Buffered, cancellationToken=ct) - |> db.connection.QueryAsync + |> db.connection.QueryAsync diff --git a/src/DatabaseMigrations.fs b/src/DatabaseMigrations.fs index f1c25d8..8004b17 100644 --- a/src/DatabaseMigrations.fs +++ b/src/DatabaseMigrations.fs @@ -184,3 +184,9 @@ type ChangeBacklogDrop () = .AddColumn("exit_code").AsCustom("smallint").NotNullable() |> ignore +[] +type BacklogDefaultTS () = + inherit OnlyUp () + override x.Up() = + """ALTER TABLE backlog ALTER COLUMN done_at SET DEFAULT current_timestamp;""" + |> x.Execute.Sql |> ignore