mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-23 21:19:31 -06:00
Update databases table schema to include pg_version field
This commit is contained in:
@@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS databases (
|
||||
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
connection_string TEXT NOT NULL,
|
||||
pg_version TEXT NOT NULL CHECK (pg_version in ('13', '14', '15', '16')),
|
||||
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
-- name: DatabasesServiceCreateDatabase :one
|
||||
INSERT INTO databases (name, connection_string)
|
||||
VALUES (@name, pgp_sym_encrypt(@connection_string, @encryption_key))
|
||||
INSERT INTO databases (
|
||||
name, connection_string, pg_version
|
||||
)
|
||||
VALUES (
|
||||
@name, pgp_sym_encrypt(@connection_string, @encryption_key), @pg_version
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
@@ -3,5 +3,6 @@ UPDATE databases
|
||||
SET
|
||||
name = @name,
|
||||
connection_string = pgp_sym_encrypt(@connection_string, @encryption_key)
|
||||
pg_version = @pg_version
|
||||
WHERE id = @id
|
||||
RETURNING *;
|
||||
|
||||
Reference in New Issue
Block a user