Skip to content

Commit

Permalink
include timestamp for when version is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
i-norden committed Dec 27, 2021
1 parent 28be111 commit e2f261c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion db/migrations/00017_create_db_version_table.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion db/migrations/00018_update_db_version.sql
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
1 change: 1 addition & 0 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);

Expand Down

0 comments on commit e2f261c

Please sign in to comment.