forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[postgres] make init scripts idempotent
This allows to attach a persistent volume to the PostgreSQL service and still always run the init scripts on startup. For the first startup with a fresh volume, the database will be initialized correctly; on subsequent starts the init scripts will do nothing.
- Loading branch information
Showing
2 changed files
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
-- Copyright The OpenTelemetry Authors | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
CREATE TABLE public.featureflags ( | ||
CREATE TABLE IF NOT EXISTS public.featureflags ( | ||
name character varying(255), | ||
description character varying(255), | ||
enabled double precision DEFAULT 0.0 NOT NULL | ||
); | ||
|
||
ALTER TABLE ONLY public.featureflags DROP CONSTRAINT featureflags_pkey; | ||
ALTER TABLE ONLY public.featureflags ADD CONSTRAINT featureflags_pkey PRIMARY KEY (name); | ||
|
||
CREATE UNIQUE INDEX featureflags_name_index ON public.featureflags USING btree (name); | ||
CREATE UNIQUE INDEX IF NOT EXISTS featureflags_name_index ON public.featureflags USING btree (name); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters