0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-11 16:17:47 +02:00
silverwind d6ae7c1c50
Simplify v332 migration and add cross-DB test
Tested against the CI image versions (postgres:14, bitnamilegacy/mysql:8.0,
mcr.microsoft.com/mssql/server:2019-latest) plus SQLite. Both the original
implementation (per-dialect SQL) and a naive `base.ModifyColumn` with
`DefaultIsEmpty: false` were tried. Findings:

- DefaultIsEmpty: false fails on MSSQL with "Incorrect syntax near the
  keyword 'DEFAULT'" because MSSQL's ALTER COLUMN does not accept inline
  DEFAULT (it lives in a separate constraint object).
- DefaultIsEmpty: true succeeds on MSSQL (existing default constraint
  unaffected) and Postgres (DEFAULT constraint is independent of TYPE)
  but drops the DEFAULT on MySQL because MODIFY COLUMN rewrites all
  column attributes.

Settled on the minimal cross-DB form: base.ModifyColumn with
DefaultIsEmpty: true to widen the type, then a MySQL-only follow-up
`ALTER ... SET DEFAULT 0` to restore the default that MODIFY COLUMN drops.

The new test seeds rows at the int8 boundary (0 and 127), runs the
migration, asserts the column type widened, the rows preserved, and that
inserting a value > 127 succeeds afterward.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
2026-05-03 14:32:38 +05:30
..
2026-05-01 15:38:38 +00:00
2026-03-07 00:28:46 +08:00
2026-05-03 14:32:37 +05:30
2026-05-03 14:32:38 +05:30