db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Creating a migration generates invalid timestamp #661

Closed dandrewgarvin closed 4 years ago

dandrewgarvin commented 4 years ago

I'm submitting a...

Current behavior

The following error is throw when attempting to run an up migration:

db-migrate up "settings-table"
[ERROR] TypeError: Cannot read property '1' of null

This prevents the migration from actually running.

Expected behavior

When the up migration script is ran, the database should be upgraded according to the content of the migration file.

NOTE: this is related to issue #379

Minimal reproduction of the problem with instructions

I believe I have tracked this issue down to a timestamp error. As shown in this snippet, the bottom file does not match the regex pattern, and thus is breaking the up script.

The pattern for a file created by create is YYYYMMDDhhmmss, but it appears that the file shown in the link above only contains YYYYMMDDhhmms, where the second is of the value 6.

This leads me to believe that the timestamp generation function was being run as the clock was transitioning between minutes (04:59->05:00), and instead of taking either the 59 or the 00, it took a very odd 60, but trimmed the time down to 6 (as how in decimal, the number 3.1000 can be trimmed to 3.1).

In my local environment, I was able to get the migration script working correctly by simply fixing the ss portion of the timestamp from 6 to either 59 or 00.

Environment


db-migrate version: 0.11.6
db-migrate driver with versions: Postgres 1.0.0

Additional information:
- Node version: 11.15.0
- Platform:  Mac
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.