Skip to content

Commit 79ae901

Browse files
committed
Fix server ID'
1 parent 4a81eb0 commit 79ae901

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

api/pkg/di/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ func (container *Container) DB() (db *gorm.DB) {
273273

274274
// This prevents a bug in the Gorm AutoMigrate where it tries to delete this no existent constraints
275275
db.Exec(`
276-
ALTER TABLE users ADD CONSTRAINT uni_users_api_key CHECK (api_key IS NOT NULL);
277-
ALTER TABLE discords ADD CONSTRAINT uni_discords_server_id CHECK (server_id IS NOT NULL);`)
276+
ALTER TABLE users ADD CONSTRAINT IF NOT EXISTS uni_users_api_key CHECK (api_key IS NOT NULL);
277+
ALTER TABLE discords ADD CONSTRAINT IF NOT EXISTS uni_discords_server_id CHECK (server_id IS NOT NULL);`)
278278

279279
if err = db.AutoMigrate(&entities.Message{}); err != nil {
280280
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Message{})))

0 commit comments

Comments
 (0)