fix: migrations
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
DELETE
|
||||
FROM migration.functions
|
||||
WHERE filename = :filename;
|
||||
WHERE filename = ?;
|
||||
@@ -4,4 +4,10 @@ VALUES (?, ?, now(), ?, ?, (
|
||||
from migration.functions f2
|
||||
where filename = f2.filename
|
||||
))
|
||||
ON CONFLICT (filename) DO UPDATE SET
|
||||
definition = excluded.definition,
|
||||
up = excluded.up,
|
||||
down = excluded.down,
|
||||
version = excluded.version,
|
||||
executed_at = now()
|
||||
RETURNING to_json(f);
|
||||
@@ -1,7 +1,7 @@
|
||||
INSERT INTO migration.history as h (filename, executed_at, up, down, version)
|
||||
VALUES (?, now(), ?, ?, (
|
||||
select coalesce(max(version), 0)+1
|
||||
from migration.history f2
|
||||
where filename = f2.filename
|
||||
from migration.history h2
|
||||
where h2.filename = filename
|
||||
))
|
||||
RETURNING to_json(h);
|
||||
|
||||
Reference in New Issue
Block a user