@@ -263,8 +263,8 @@ jobs:
263263run :docker compose down
264264shell :pwsh
265265
266- check -migration-order :
267- name :Validate migrationchronological order
266+ validate -migration-naming :
267+ name :Validatenew migrationnaming and order
268268runs-on :ubuntu-22.04
269269
270270steps :
@@ -274,7 +274,7 @@ jobs:
274274fetch-depth :0
275275persist-credentials :false
276276
277- -name :Validatemigration order for pull request
277+ -name :Validatenew migrations for pull request
278278if :github.event_name == 'pull_request'
279279run :|
280280 # Use C locale for consistent, locale-independent string comparison
@@ -312,10 +312,15 @@ jobs:
312312 while IFS= read -r migration; do
313313 MIGRATION_NAME=$(basename "$migration")
314314
315- # Validate migration filename format (YYYY-MM-DD_NN_Description.sql with leading zeros)
315+ # Validate NEW migration filename format - enforce strict format for new migrations
316+ # Required format: YYYY-MM-DD_NN_Description.sql (with leading zeros in date and sequence)
316317 if ! [[ "$MIGRATION_NAME" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}_.+\.sql$ ]]; then
317- echo "ERROR: Migration '$MIGRATION_NAME' does not match expected format"
318- echo "Expected format: YYYY-MM-DD_NN_Description.sql (with leading zeros)"
318+ echo "ERROR: Migration '$MIGRATION_NAME' does not match required format"
319+ echo "Required format: YYYY-MM-DD_NN_Description.sql"
320+ echo " - YYYY: 4-digit year"
321+ echo " - MM: 2-digit month with leading zero (01-12)"
322+ echo " - DD: 2-digit day with leading zero (01-31)"
323+ echo " - NN: 2-digit sequence number (00, 01, 02, etc.)"
319324 echo "Example: 2025-01-15_00_MyMigration.sql"
320325 VALIDATION_FAILED=1
321326 continue
@@ -332,24 +337,27 @@ jobs:
332337
333338 echo ""
334339 if [ $VALIDATION_FAILED -eq 1 ]; then
335- echo "FAILED: One or more migrations are not in chronological order or incorrectly formatted "
340+ echo "FAILED: One or more migrations areincorrectly named or not in chronological order"
336341 echo ""
337- echo "Migration files must be named to execute in chronological order."
338- echo "New migrations must have dates/names that come after existing migrations."
339- echo "Expected format: YYYY-MM-DD_NN_Description.sql (with leading zeros)"
342+ echo "All new migration files must:"
343+ echo " 1. Follow the naming format: YYYY-MM-DD_NN_Description.sql"
344+ echo " 2. Use leading zeros in dates (e.g., 2025-01-05, not 2025-1-5)"
345+ echo " 3. Include a 2-digit sequence number (e.g., _00, _01)"
346+ echo " 4. Have a filename that sorts after the last migration in main"
340347 echo ""
341348 echo "To fix this issue:"
342349 echo " 1. Locate your migration file(s) in util/Migrator/DbScripts/"
343- echo " 2. Rename the file to use a date after $LAST_MAIN_MIGRATION"
344- echo " 3. Ensure the date format is YYYY-MM-DD with leading zeros (e.g., 2025-01-05, not 2025-1-5)"
345- echo " 4. Use _NN suffix (e.g., _00, _01) if multiple migrations exist for the same date"
350+ echo " 2. Rename to follow format: YYYY-MM-DD_NN_Description.sql"
351+ echo " 3. Ensure the date is after $LAST_MAIN_MIGRATION"
352+ echo ""
353+ echo "Example: 2025-01-15_00_AddNewFeature.sql"
346354 exit 1
347355 fi
348356
349- echo "SUCCESS: All new migrations arein correct chronological order"
357+ echo "SUCCESS: All new migrations arecorrectly named and in chronological order"
350358shell :bash
351359
352- -name :Validatemigration order for push
360+ -name :Validatenew migrations for push
353361if :github.event_name == 'push' || github.event_name == 'workflow_dispatch'
354362run :|
355363 # Use C locale for consistent, locale-independent string comparison
@@ -387,10 +395,15 @@ jobs:
387395 while IFS= read -r migration; do
388396 MIGRATION_NAME=$(basename "$migration")
389397
390- # Validate migration filename format (YYYY-MM-DD_NN_Description.sql with leading zeros)
398+ # Validate NEW migration filename format - enforce strict format for new migrations
399+ # Required format: YYYY-MM-DD_NN_Description.sql (with leading zeros in date and sequence)
391400 if ! [[ "$MIGRATION_NAME" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}_.+\.sql$ ]]; then
392- echo "ERROR: Migration '$MIGRATION_NAME' does not match expected format"
393- echo "Expected format: YYYY-MM-DD_NN_Description.sql (with leading zeros)"
401+ echo "ERROR: Migration '$MIGRATION_NAME' does not match required format"
402+ echo "Required format: YYYY-MM-DD_NN_Description.sql"
403+ echo " - YYYY: 4-digit year"
404+ echo " - MM: 2-digit month with leading zero (01-12)"
405+ echo " - DD: 2-digit day with leading zero (01-31)"
406+ echo " - NN: 2-digit sequence number (00, 01, 02, etc.)"
394407 echo "Example: 2025-01-15_00_MyMigration.sql"
395408 VALIDATION_FAILED=1
396409 continue
@@ -407,11 +420,13 @@ jobs:
407420
408421 echo ""
409422 if [ $VALIDATION_FAILED -eq 1 ]; then
410- echo "FAILED: One or more migrations are not in chronological order or incorrectly formatted "
423+ echo "FAILED: One or more migrations areincorrectly named or not in chronological order"
411424 echo ""
412- echo "Migration files must be named to execute in chronological order."
413- echo "New migrations must have dates/names that come after existing migrations."
414- echo "Expected format: YYYY-MM-DD_NN_Description.sql (with leading zeros)"
425+ echo "All new migration files must:"
426+ echo " 1. Follow the naming format: YYYY-MM-DD_NN_Description.sql"
427+ echo " 2. Use leading zeros in dates (e.g., 2025-01-05, not 2025-1-5)"
428+ echo " 3. Include a 2-digit sequence number (e.g., _00, _01)"
429+ echo " 4. Have a filename that sorts after the last migration"
415430 echo ""
416431 echo "Migration files are located in: util/Migrator/DbScripts/"
417432 exit 1
@@ -420,5 +435,5 @@ jobs:
420435 echo "No previous migrations found (initial commit?). Skipping validation."
421436 fi
422437
423- echo "SUCCESS: All new migrations arein correct chronological order"
438+ echo "SUCCESS: All new migrations arecorrectly named and in chronological order"
424439shell :bash