Skip to content

Commit

Permalink
fix: use mysql json default as expression (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr authored Jan 1, 2025
1 parent e1e5828 commit d75de89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion internal/database/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d75de89

Please sign in to comment.