rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.16k stars 269 forks source link

Limit Precision of Time values written to Migrations table #256

Open caseybrown89 opened 8 months ago

caseybrown89 commented 8 months ago

I am using a database (SingleStore) that can't support more than 6 milliseconds of precision when inserting timestamp values into its database. When migrations are executed, the insert into the tracking table fails. This PR introduces a limit precision option that rounds timestamps prior to their insertion into the migrations table.

I added test coverage on the sql-parse/config.go (both my functionality and previously existing).

If this is too specific, the limit precision option could be modified to provide a variable rounding option so that it's more adaptable/reusable to other scenarios (I know it's a bit niche atm)