fix: use mysql json default as expression (#1048)

This commit is contained in:
Felipe Martin 2025-01-01 16:12:07 +01:00 committed by GitHub
parent e1e58289a2
commit d75de89701
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS account(
username VARCHAR(250) NOT NULL,
password BINARY(80) NOT NULL,
owner TINYINT(1) NOT NULL DEFAULT '0',
config JSON NOT NULL DEFAULT '{}',
config JSON NOT NULL DEFAULT ('{}'),
PRIMARY KEY (id),
UNIQUE KEY account_username_UNIQUE (username))
CHARACTER SET utf8mb4;

View file

@ -48,7 +48,7 @@ var mysqlMigrations = []migration{
}
defer tx.Rollback()
_, err = tx.Exec(`ALTER TABLE account ADD COLUMN config JSON NOT NULL DEFAULT '{}'`)
_, err = tx.Exec(`ALTER TABLE account ADD COLUMN config JSON NOT NULL DEFAULT ('{}')`)
if err != nil && strings.Contains(err.Error(), `Duplicate column name`) {
tx.Rollback()
} else if err != nil {