Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
feat(users): add unique constraint to clients name
Browse files Browse the repository at this point in the history
This commit adds a new migration to the users. The migration adds a unique constraint to the "clients" table in the database. This constraint ensures that the "name" column of the "clients" table is unique.
  • Loading branch information
rodneyosodo committed Nov 23, 2023
1 parent c5b34f0 commit c6a1c59
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions users/postgres/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ func Migration() *migrate.MemoryMigrationSource {
`DROP TABLE IF EXISTS clients`,
},
},
{
Id: "clients_02",
Up: []string{
`ALTER TABLE clients ADD CONSTRAINT clients_name_key UNIQUE (name)`,
},
Down: []string{
`ALTER TABLE clients DROP CONSTRAINT clients_name_key`,
},
},
},
}
}

0 comments on commit c6a1c59

Please sign in to comment.