Skip to content

Commit

Permalink
Fix server ID'
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed May 3, 2024
1 parent 4a81eb0 commit 79ae901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/pkg/di/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ func (container *Container) DB() (db *gorm.DB) {

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

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

0 comments on commit 79ae901

Please sign in to comment.