Skip to content

fix(account): MySQL TEXT column default value compatibility (#502)#503

Merged
chenyme merged 1 commit intochenyme:mainfrom
armorbreak001:fix/mysql-text-default-compat
Apr 22, 2026
Merged

fix(account): MySQL TEXT column default value compatibility (#502)#503
chenyme merged 1 commit intochenyme:mainfrom
armorbreak001:fix/mysql-text-default-compat

Conversation

@armorbreak001
Copy link
Copy Markdown
Contributor

Problem

Deploying on MySQL (e.g. Vercel + Aiven MySQL) fails at startup with:

MySQL does not allow values on , , or columns. The migration uses raw SQL that hits this restriction.

Fix

For MySQL: split the migration into three idempotent steps:

  1. (nullable, no default)
  2. (backfill existing rows)
  3. (promote to non-nullable)

For PostgreSQL: unchanged — works fine on Postgres.

The application layer already handles NULL/ coercion ( uses ), so the backfill value is consistent with existing behavior.

Closes #502

MySQL does not allow DEFAULT values on TEXT/BLOB/JSON columns (error 1101).
Split the ALTER TABLE migration into three steps for MySQL: add as nullable
TEXT, backfill existing rows with '{}', then promote to NOT NULL.
PostgreSQL path is unchanged.
@chenyme chenyme merged commit 5551f9c into chenyme:main Apr 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 最新版部署后,由于数据库默认值导致 系统503

2 participants