Commit da091e75c9b1101c74adc62e7be746b5ff2e4731
Committed by
GitHub
Merge pull request #3217 from YevhenBondarenko/feature/tb-schema-settings
created procedure insert_tb_schema_settings
Showing
1 changed file
with
11 additions
and
1 deletions
... | ... | @@ -20,7 +20,17 @@ CREATE TABLE IF NOT EXISTS tb_schema_settings |
20 | 20 | CONSTRAINT tb_schema_settings_pkey PRIMARY KEY (schema_version) |
21 | 21 | ); |
22 | 22 | |
23 | -INSERT INTO tb_schema_settings (schema_version) VALUES (3001000) ON CONFLICT (schema_version) DO UPDATE SET schema_version = 3001000; | |
23 | +CREATE OR REPLACE PROCEDURE insert_tb_schema_settings() | |
24 | + LANGUAGE plpgsql AS | |
25 | +$$ | |
26 | +BEGIN | |
27 | + IF (SELECT COUNT(*) FROM tb_schema_settings) = 0 THEN | |
28 | + INSERT INTO tb_schema_settings (schema_version) VALUES (3001000); | |
29 | + END IF; | |
30 | +END; | |
31 | +$$; | |
32 | + | |
33 | +call insert_tb_schema_settings(); | |
24 | 34 | |
25 | 35 | CREATE TABLE IF NOT EXISTS admin_settings ( |
26 | 36 | id uuid NOT NULL CONSTRAINT admin_settings_pkey PRIMARY KEY, | ... | ... |