feat(DB): stop upgrade on version hopping
This commit is contained in:
parent
e69bcbeff8
commit
13986a3c55
2 changed files with 34 additions and 0 deletions
|
|
@ -1,3 +1,20 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.10.0-ee';
|
||||
next_version CONSTANT text := 'v1.11.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
BEGIN;
|
||||
CREATE OR REPLACE FUNCTION openreplay_version()
|
||||
RETURNS text AS
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.10.0';
|
||||
next_version CONSTANT text := 'v1.11.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
BEGIN;
|
||||
CREATE OR REPLACE FUNCTION openreplay_version()
|
||||
RETURNS text AS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue