Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Fix server ID'

Acho Arnold79ae9012c845
diff --git a/api/pkg/di/container.go b/api/pkg/di/container.go
index bb70e330..6af05934 100644
--- a/api/pkg/di/container.go
+++ b/api/pkg/di/container.go
@@ -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{})))