kawadhiya21 / mysql-migrations

A tool to use with mysql package to maintain migrations
MIT License
31 stars 25 forks source link

Processes all files as JavaScript #27

Open lewismoten opened 3 months ago

lewismoten commented 3 months ago

I renamed a migration file with a .txt extension to get the migration script to skip over it, but it was still processed as a JavaScript migration.

An easy work-around for me is to prefix the file name with an underscore _ instead so that it doesn't pass the timestamp length test. However, I don't recall seeing the error thrown about being an invalid file. I would have expected this to only parse javascript files with case-insensitive js cjs or mjs extensions.

The other day I tried associating SQL files in the same folder to get syntax highlighting and didn't realize what the issue was. ie same name 1716831766170_create_function_uuid4.up.sql to keep it close to the migration script, and do a file.readSync on the sql file.

https://github.com/kawadhiya21/mysql-migrations/blob/65c52086c766d5c91508ba66c3b811682484c4b2/core_functions.js#L44-L55