include timestamp for when version is updated

This commit is contained in:
i-norden 2021-12-27 13:52:52 -06:00
parent 28be11187c
commit e2f261caa9
5 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,8 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS public.db_version (
singleton BOOLEAN NOT NULL DEFAULT TRUE UNIQUE CHECK (singleton),
version TEXT NOT NULL
version TEXT NOT NULL,
tstamp TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
);
-- +goose Down

View File

@ -1,6 +1,6 @@
-- +goose Up
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v0.3.2')
ON CONFLICT (singleton) DO UPDATE SET version = 'v0.3.2';
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v0.3.2', NOW());
-- +goose Down
DELETE FROM public.db_version WHERE version = 'v0.3.2';

View File

@ -1,7 +1,8 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS public.db_version (
singleton BOOLEAN NOT NULL DEFAULT TRUE UNIQUE CHECK (singleton),
version TEXT NOT NULL
version TEXT NOT NULL,
tstamp TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
);
-- +goose Down

View File

@ -1,6 +1,6 @@
-- +goose Up
INSERT INTO public.db_version (singleton, version) VALUES (true, 'v0.3.2')
ON CONFLICT (singleton) DO UPDATE SET version = 'v0.3.2';
ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v0.3.2', NOW());
-- +goose Down
DELETE FROM public.db_version WHERE version = 'v0.3.2';

View File

@ -419,6 +419,7 @@ CREATE TABLE public.blocks (
CREATE TABLE public.db_version (
singleton boolean DEFAULT true NOT NULL,
version text NOT NULL,
tstamp timestamp without time zone DEFAULT now(),
CONSTRAINT db_version_singleton_check CHECK (singleton)
);