mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-25 19:36:07 +00:00
Migrations ordered after 1786700003000 must not seed through cmd/migrate/migration/models. That package's ModelTime declares a nullable gorm.DeletedAt, which is the shape the columns had until that migration converted deleted_at to a NOT NULL millisecond marker. Afterwards it breaks in both directions. Writes put NULL into a NOT NULL column and fail on the first insert. Reads are scoped "WHERE deleted_at IS NULL" while live rows hold 0, so they match nothing - and 1786700001000 looks the admin role up that way and treats ErrRecordNotFound as "roles are not seeded yet, skip authorisation", which would leave a module seeded with no permissions and the migration still recorded as applied. A fresh database does not surface either one: every migration using that package today is ordered before the conversion, so it runs while the column is still nullable. Only a migration added afterwards hits it. Also pulls the import scan out of importsRuntimeModels so both checks share one implementation, and derives the version through migration.GetFilename rather than a second filename-parsing rule. Verified by adding a violating migration and confirming the test fails with an actionable message, then removing it and confirming the suite passes. Claude-Session: https://claude.ai/code/session_01DJhM6LvhkNPej35wy9F7Aq