mirror of
https://github.com/therootcompany/golib.git
synced 2026-04-24 12:48:00 +00:00
Across all four backends: - TestAppliedOrdering: insert rows out of order, verify Applied() returns them sorted by name. Guards against the ORDER BY clause being dropped or the query returning rows in arbitrary order. - TestEndToEndCycle: Collect → Up → Applied → Down → Applied via the sqlmigrate orchestrator with real migration files. Catches wiring bugs between Migrator and orchestrator that the in-package mockMigrator tests cannot. - TestDMLRollback: multi-statement DML migration where the last statement fails, verifies earlier INSERTs are rolled back. MySQL note: DML-only because MySQL implicitly commits DDL. Dialect-specific: - mymigrate TestMultiStatementsRequired: strip multiStatements=true from the DSN, verify ExecUp fails with a clear error mentioning multiStatements (rather than silently running only the first statement of a multi-statement migration). - litemigrate TestForeignKeyEnforcement: verifies FK constraints are enforced when the DSN includes _pragma=foreign_keys(1). Test fixture fix: cleanup closures now use context.Background() instead of the test context. t.Context() is canceled before t.Cleanup runs, so DB cleanup silently failed. Previously the _migrations cleanup appeared to work because the next test's connect() re-ran DROP TABLE at setup, but domain tables (test_*) leaked across runs. New tests also pre-clean at setup for self-healing after interrupted runs.
golib
Sometimes a little copying, sometimes a little dependency. Too small for their own repos.
The default branch is dev, but the stable, versioned tags are based on main.
Also, my Go Cheatsheet:
Languages
Go
100%