@@ -61,48 +61,51 @@ jobs:
6161 echo "❌ No migration files were updated"
6262 fi
6363
64- - name : Generate migrations to verify
64+ - name : Verify migrations were committed with model changes
6565 if : steps.check_models.outputs.models_changed == 'true'
66- working-directory : taco
67- run : |
68- echo "Generating migrations to check for drift..."
69- make atlas-diff-all name=ci_check
70-
71- - name : Check for uncommitted migrations
72- if : steps.check_models.outputs.models_changed == 'true'
73- working-directory : taco
7466 run : |
75- if ! git diff --exit-code migrations/ ; then
67+ if [ "${{ steps.check_migrations.outputs.migrations_changed }}" != "true" ] ; then
7668 echo ""
77- echo "❌ ERROR: Model changes detected but migrations were not generated !"
69+ echo "❌ ERROR: Model changes detected but no migrations were committed !"
7870 echo ""
79- echo "📝 You modified GORM models but didn't generate corresponding migrations."
71+ echo "📝 You modified GORM models in taco/internal/query/types/"
72+ echo " but didn't generate and commit corresponding migrations."
8073 echo ""
81- echo "To fix this, run:"
82- echo " cd taco"
83- echo " make atlas-diff-all name=<descriptive_name>"
74+ echo "To fix this:"
75+ echo " 1. cd taco"
76+ echo " 2. make atlas-diff-all name=descriptive_name"
77+ echo " 3. git add migrations/"
78+ echo " 4. git commit"
8479 echo ""
85- echo "For example :"
80+ echo "Example :"
8681 echo " make atlas-diff-all name=add_user_email_field"
8782 echo ""
88- echo "Then commit the generated migration files."
89- echo ""
9083 exit 1
9184 else
92- if [ "${{ steps.check_migrations.outputs.migrations_changed }}" = "true" ]; then
93- echo "✅ Migrations are up to date with model changes"
94- else
95- echo "✅ No schema changes detected (models changed but schema is the same)"
96- fi
85+ echo "✅ Model changes have corresponding migration files committed"
9786 fi
9887
9988 - name : Validate migration files
10089 if : steps.check_migrations.outputs.migrations_changed == 'true'
10190 working-directory : taco
10291 run : |
103- echo "Validating migration files..."
104- make atlas-lint-all
105- echo "✅ All migration files are valid"
92+ echo "Ensuring migration checksums are up to date..."
93+ make atlas-hash-all
94+
95+ echo "Validating migration file format..."
96+ # Just check that .sql files exist and are non-empty
97+ for db in postgres mysql sqlite; do
98+ if [ -d "migrations/$db" ]; then
99+ sql_files=$(find migrations/$db -name "*.sql" -type f)
100+ if [ -z "$sql_files" ]; then
101+ echo "❌ No .sql files found in migrations/$db"
102+ exit 1
103+ fi
104+ echo "✅ Found migration files in migrations/$db"
105+ fi
106+ done
107+
108+ echo "✅ All migration files validated"
106109
107110 - name : Summary
108111 if : always()
0 commit comments