From 6b55482d34c6cbd165671ddbb054e27af0e93215 Mon Sep 17 00:00:00 2001 From: "Everton H. Taques" <97463920+etaques@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:08:34 -0300 Subject: [PATCH] fix (maestro): create db, add unique constraint (#2742) --- maestro/postgres/init.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maestro/postgres/init.go b/maestro/postgres/init.go index 4926feb3e..fd7f8d890 100644 --- a/maestro/postgres/init.go +++ b/maestro/postgres/init.go @@ -33,6 +33,7 @@ func migrateDB(db *sqlx.DB) error { { Id: "1", Up: []string{ + `CREATE DATABASE IF NOT EXISTS maestro;`, `CREATE TABLE IF NOT EXISTS deployments ( id UUID NOT NULL DEFAULT gen_random_uuid(), owner_id VARCHAR(255), @@ -47,6 +48,7 @@ func migrateDB(db *sqlx.DB) error { last_collector_deploy_time TIMESTAMP, last_collector_stop_time TIMESTAMP );`, + `ALTER TABLE "deployments" ADD CONSTRAINT "deployments_owner_id_sink_id" UNIQUE ("owner_id", "sink_id");`, }, Down: []string{ "DROP TABLE deployments",