chucknorris / roundhouse

RoundhousE is a Database Migration Utility for .NET using sql files and versioning based on source control
http://projectroundhouse.org
916 stars 249 forks source link

RH on linux running up scripts in "reverse" order. #386

Closed domingoladron closed 4 years ago

domingoladron commented 4 years ago

This one took a while for me to work out, and I hope someone can help with how best to get around it.

So we have a folder structure for our up scripts:

- up
  - 0000_FirstScripts
    - 0001-Script1.sql
    - 0002-Script2.sql
  - 0001_SecondScripts
    - 0001-Script3.sql
    - 0002-Script4.sql
 - 0002_ThirdScripts
    - 0001-Script5.sql
    - 0002-Script6.sql

etc.

Now, when running this via the RH dotnet tool on windows, scripts are run in the expected order, top to bottom, from 0000 directory on downwards.

When running the same using the RH dotnet tool on linux, the order of the scripts run appears to be reversed, that is, starting with the LAST folder, 0002-ThirdScripts, then running the scripts inside that folder in top to bottom order, e.g. 0001-Script5.sql, 0002-Script6.sql, then back to 0001-SecondScripts, etc.

Now , our naming convention might be a bad one, so what naming standards are recommended to ensure things are run in the right order. In reading the source code, I see it is reading the filename from a path only, without the folder. Would we need to name scripts as all numbered away from one another, irrespective of subdirectory?

Let me know

JscNZ commented 4 years ago

Should be resolved once #393 is released 👍