sqldb: add table to track custom SQL migrations

This commit adds the migration_tracker table which we'll use to track if
a custom migration has already been done.
This commit is contained in:
Andras Banki-Horvath
2024-11-12 16:25:29 +01:00
parent 680394518f
commit 9acd06d296
6 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
-- name: SetMigration :exec
INSERT INTO
migration_tracker (version, migration_time)
VALUES ($1, $2);
-- name: GetMigration :one
SELECT
migration_time
FROM
migration_tracker
WHERE
version = $1;
-- name: GetDatabaseVersion :one
SELECT
version
FROM
migration_tracker
ORDER BY
version DESC
LIMIT 1;