From b8e0d6f41864d595a49a6e714ad499d1c6f03a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lapeyre?= Date: Wed, 14 Jul 2021 11:59:14 +0200 Subject: [PATCH] Add UNIQUE constraint in the states table for the pg backend --- internal/backend/remote-state/pg/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/backend/remote-state/pg/backend.go b/internal/backend/remote-state/pg/backend.go index e7e63028d..cdcfb3a6e 100644 --- a/internal/backend/remote-state/pg/backend.go +++ b/internal/backend/remote-state/pg/backend.go @@ -111,7 +111,7 @@ func (b *Backend) configure(ctx context.Context) error { query = `CREATE TABLE IF NOT EXISTS %s.%s ( id bigint NOT NULL DEFAULT nextval('public.global_states_id_seq') PRIMARY KEY, - name text, + name text UNIQUE, data text )` if _, err := db.Exec(fmt.Sprintf(query, b.schemaName, statesTableName)); err != nil {