AngelMunoz/Migrondi

Accepted file pattern for the commands new and up differs

Closed this issue · 5 comments

funkr commented

Hi Angel,

I tried your tool today and it worked fine.
I found just one little issue.

The tool accept this for the new command:

migrondi.exe new -n setup-model.sql

but the resulting file is invalid due to the hyphen.

setup-model.sql_1626383847780.sql

BR Roman

Yeah this doesn't look right, I'll see what I can do next week unless @VitorRigoni can fix it faster 😁

Uhoh! That's definitely on me😅
I'm away for the weekend and won't have access to a computer until Sunday night. I can give it a go probably Sunday or Monday evening.
Meanwhile a workaround would be to camel case the file name like "setupModel"

@funkr I'm just testing the issue and it happens that the file name should not have .sql .
So migrondi new -n setup-model creates a file like setup-model_1626383847780.sql.
Either way, I can't reproduce this issue. I was able to create a migration called setup-data_1626741766479.sql and even tried the setup-data.sql_1626741805473.sql. Added some dumb sql like create tables and both worked fine on the latest version:

PS H:\Projects\Migrondi> .\dist\win10-x64\Migrondi.exe init
Created H:\Projects\Migrondi\migrondi.json and migrations\
PS H:\Projects\Migrondi> .\dist\win10-x64\Migrondi.exe new --name setup-data    
Created: H:\Projects\Migrondi\migrations\setup-data_1626741766479.sql
PS H:\Projects\Migrondi> .\dist\win10-x64\Migrondi.exe up
Migrations Applied: 1
PS H:\Projects\Migrondi> .\dist\win10-x64\Migrondi.exe new --name setup-data.sql
Created: H:\Projects\Migrondi\migrations\setup-data.sql_1626741805473.sql
PS H:\Projects\Migrondi> .\dist\win10-x64\Migrondi.exe up
Migrations Applied: 1    
PS H:\Projects\Migrondi> 
funkr commented

@funkr Looks like it's working just fine, perhaps we might need to strip common extensions from the migration name, but I think that's just a small implementation detail, you can always delete the migration before using it and creating a new one with the correct name

for now I agree with @VitorRigoni and it's working just fine, I'll close this issue since it's (albeit weirdly) working as expected
if you feel adventurous you can contribute this enhancement you mention feel free to re-open and I'll gladly review any PR you send