diff --git a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql index d77f6daf3..bc509bfd2 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -790,7 +790,7 @@ $$ CREATE INDEX IF NOT EXISTS metric_series_metric_id_idx ON public.metric_series (metric_id); - CREATE TABLE dashboards + CREATE TABLE IF NOT EXISTS public.dashboards ( dashboard_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY, project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE, @@ -803,7 +803,7 @@ $$ deleted_at timestamp NULL DEFAULT NULL ); - CREATE TABLE dashboard_widgets + CREATE TABLE IF NOT EXISTS public.dashboard_widgets ( widget_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY, dashboard_id integer NOT NULL REFERENCES public.dashboards (dashboard_id) ON DELETE CASCADE, @@ -927,7 +927,7 @@ $$ CREATE INDEX IF NOT EXISTS idx_feature_flags_project_id ON public.feature_flags (project_id); - ALTER TABLE feature_flags + ALTER TABLE public.feature_flags ADD CONSTRAINT unique_project_flag_deleted UNIQUE (project_id, flag_key, deleted_at); CREATE TABLE IF NOT EXISTS public.feature_flags_conditions @@ -1110,7 +1110,7 @@ $$ CREATE INDEX IF NOT EXISTS errors_error_id_timestamp_session_id_idx ON events.errors (error_id, timestamp, session_id); CREATE INDEX IF NOT EXISTS errors_error_id_idx ON events.errors (error_id); - CREATE TABLE IF NOT EXISTS errors_tags + CREATE TABLE IF NOT EXISTS public.errors_tags ( key text NOT NULL, value text NOT NULL, diff --git a/scripts/schema/db/init_dbs/postgresql/1.15.0/1.15.0.sql b/scripts/schema/db/init_dbs/postgresql/1.15.0/1.15.0.sql index 6631f5cfb..d322e51ac 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.15.0/1.15.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.15.0/1.15.0.sql @@ -19,7 +19,7 @@ $fn_def$, :'next_version') -- ALTER TABLE IF EXISTS events_common.requests - ADD COLUMN transfer_size bigint NULL; + ADD COLUMN IF NOT EXISTS transfer_size bigint NULL; ALTER TABLE IF EXISTS public.sessions ADD COLUMN IF NOT EXISTS timezone text NULL;