db
This commit is contained in:
parent
ef97881270
commit
a5cccaca27
2 changed files with 11 additions and 2 deletions
|
@ -50,13 +50,16 @@ let make (logger: ILogger) =
|
||||||
use listen = new NpgsqlCommand ("LISTEN bidello_database_update;", conn)
|
use listen = new NpgsqlCommand ("LISTEN bidello_database_update;", conn)
|
||||||
listen.ExecuteNonQuery () |> ignore
|
listen.ExecuteNonQuery () |> ignore
|
||||||
|
|
||||||
|
logger.Information "Successfully connected to the database."
|
||||||
|
|
||||||
{connection = conn}
|
{connection = conn}
|
||||||
|
|
||||||
|
|
||||||
let wait_notification (ct: CancellationToken) (db: t) =
|
let wait_notification (ct: CancellationToken) (db: t) =
|
||||||
db.connection.WaitAsync ct
|
db.connection.WaitAsync ct
|
||||||
|
|
||||||
type Requirements_ = {
|
[<CLIMutable>]
|
||||||
|
type Requirements = {
|
||||||
job_name: string
|
job_name: string
|
||||||
``when``: string
|
``when``: string
|
||||||
executable: string
|
executable: string
|
||||||
|
@ -86,4 +89,4 @@ group by c.job_name, h.hostname """
|
||||||
new CommandDefinition (query, parameters=param, transaction=null,
|
new CommandDefinition (query, parameters=param, transaction=null,
|
||||||
commandTimeout=nl, commandType=cl,
|
commandTimeout=nl, commandType=cl,
|
||||||
flags=CommandFlags.Buffered, cancellationToken=ct)
|
flags=CommandFlags.Buffered, cancellationToken=ct)
|
||||||
|> db.connection.QueryAsync<Requirements_>
|
|> db.connection.QueryAsync<Requirements>
|
||||||
|
|
|
@ -184,3 +184,9 @@ type ChangeBacklogDrop () =
|
||||||
.AddColumn("exit_code").AsCustom("smallint").NotNullable()
|
.AddColumn("exit_code").AsCustom("smallint").NotNullable()
|
||||||
|> ignore
|
|> ignore
|
||||||
|
|
||||||
|
[<Migration(20241024_0001L)>]
|
||||||
|
type BacklogDefaultTS () =
|
||||||
|
inherit OnlyUp ()
|
||||||
|
override x.Up() =
|
||||||
|
"""ALTER TABLE backlog ALTER COLUMN done_at SET DEFAULT current_timestamp;"""
|
||||||
|
|> x.Execute.Sql |> ignore
|
||||||
|
|
Loading…
Reference in a new issue