Add UNIQUE constraint in the states table for the pg backend

This commit is contained in:
Rémi Lapeyre 2021-07-14 11:59:14 +02:00
parent 3bf053a5fc
commit b8e0d6f418

View File

@ -111,7 +111,7 @@ func (b *Backend) configure(ctx context.Context) error {
query = `CREATE TABLE IF NOT EXISTS %s.%s ( query = `CREATE TABLE IF NOT EXISTS %s.%s (
id bigint NOT NULL DEFAULT nextval('public.global_states_id_seq') PRIMARY KEY, id bigint NOT NULL DEFAULT nextval('public.global_states_id_seq') PRIMARY KEY,
name text, name text UNIQUE,
data text data text
)` )`
if _, err := db.Exec(fmt.Sprintf(query, b.schemaName, statesTableName)); err != nil { if _, err := db.Exec(fmt.Sprintf(query, b.schemaName, statesTableName)); err != nil {