Skip to content
Merged

Atlas #2333

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
38b0674
migrator, package atlas in dockerfile, fallback, set CGO in dockerfil…
breardon2011 Oct 22, 2025
8302ed3
correct go version back 1.24, downgrade argia/atlas to 1.24 compat
breardon2011 Oct 22, 2025
652be9a
adjust atlas loader, versions
breardon2011 Oct 23, 2025
3abefae
remove automigrate
breardon2011 Oct 23, 2025
30d74a7
Merge branch 'develop' of https://github.com/diggerhq/digger into fea…
breardon2011 Oct 23, 2025
5139db9
add migration workflow test
breardon2011 Oct 24, 2025
04ffe07
Added migrations files
breardon2011 Oct 24, 2025
30c9478
Change embed location
breardon2011 Oct 24, 2025
86ecc22
move migrations to where they can be embedded
breardon2011 Oct 24, 2025
b33fc03
add golang migrate
breardon2011 Oct 24, 2025
a8776d5
adjust for golang-migrate
breardon2011 Oct 24, 2025
9f44ecd
adjust test
breardon2011 Oct 24, 2025
888a5a8
adjust workflow
breardon2011 Oct 24, 2025
8cc4c3d
update test
breardon2011 Oct 24, 2025
100a0be
adjust test again
breardon2011 Oct 24, 2025
d86457f
remove checksums from repo
breardon2011 Oct 24, 2025
664a66f
update workflow to handle checksums correctly
breardon2011 Oct 24, 2025
e323cff
package atlas, remove go migrate from migrator
breardon2011 Oct 24, 2025
0fe2372
adjust workflow
breardon2011 Oct 24, 2025
8d34e96
switch to atlas like backend
breardon2011 Oct 25, 2025
f21f1c2
add workflow files
breardon2011 Oct 25, 2025
9d47515
update workflows
breardon2011 Oct 25, 2025
fa86205
fix workflow to generate hash
breardon2011 Oct 25, 2025
3135d2f
set query backend correctly
breardon2011 Oct 25, 2025
0c98181
adjust db name
breardon2011 Oct 25, 2025
c020c8f
change loader, sequence, handle syntax
breardon2011 Oct 25, 2025
67b6ad3
Merge branch 'develop' of https://github.com/diggerhq/digger into fea…
breardon2011 Oct 25, 2025
60a6cba
merge and regen
breardon2011 Oct 25, 2025
e59ebec
fix CGO, grep
breardon2011 Oct 25, 2025
e7d0e4c
adjust address of sqlite
breardon2011 Oct 25, 2025
1641f3a
adjust sqlite db envar for workflow
breardon2011 Oct 25, 2025
fed8032
add command, instructions
breardon2011 Oct 27, 2025
261d6cd
use gorm provider
breardon2011 Oct 27, 2025
4dfc6b0
multi dialect wip
breardon2011 Oct 28, 2025
703921d
Revert to fed8032a
breardon2011 Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/check-migrations-generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Check Migrations Generated

on:
pull_request:
paths:
- 'taco/internal/query/types/**'
- 'taco/atlas.hcl'
- 'taco/internal/atlas_loader.go'
workflow_dispatch: # Allows manual trigger from GitHub UI

jobs:
check-migrations:
name: Verify Migrations Were Generated
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history to check file changes

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: |
taco/go.sum
go.work.sum

- name: Install Atlas CLI
run: |
curl -sSf https://atlasgo.sh | sh
atlas version

- name: Install Atlas GORM Provider
run: go install ariga.io/atlas-provider-gorm@latest

- name: Check if model files changed
id: check_models
run: |
# Check if any GORM model files changed in this PR
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "taco/internal/query/types/"; then
echo "models_changed=true" >> $GITHUB_OUTPUT
echo "✋ GORM models were modified"
else
echo "models_changed=false" >> $GITHUB_OUTPUT
echo "✅ No GORM model changes detected"
fi

- name: Check if migrations changed
id: check_migrations
if: steps.check_models.outputs.models_changed == 'true'
run: |
# Check if migration files changed in this PR
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "taco/migrations/"; then
echo "migrations_changed=true" >> $GITHUB_OUTPUT
echo "✅ Migration files were updated"
else
echo "migrations_changed=false" >> $GITHUB_OUTPUT
echo "❌ No migration files were updated"
fi

- name: Verify migrations were committed with model changes
if: steps.check_models.outputs.models_changed == 'true'
run: |
if [ "${{ steps.check_migrations.outputs.migrations_changed }}" != "true" ]; then
echo ""
echo "❌ ERROR: Model changes detected but no migrations were committed!"
echo ""
echo "📝 You modified GORM models in taco/internal/query/types/"
echo " but didn't generate and commit corresponding migrations."
echo ""
echo "To fix this:"
echo " 1. cd taco"
echo " 2. make atlas-diff-all name=descriptive_name"
echo " 3. git add migrations/"
echo " 4. git commit"
echo ""
echo "Example:"
echo " make atlas-diff-all name=add_user_email_field"
echo ""
exit 1
else
echo "✅ Model changes have corresponding migration files committed"
fi

- name: Validate migration files
if: steps.check_migrations.outputs.migrations_changed == 'true'
working-directory: taco
run: |
echo "Ensuring migration checksums are up to date..."
make atlas-hash-all

echo "Validating migration file format..."
# Just check that .sql files exist and are non-empty
for db in postgres mysql sqlite; do
if [ -d "migrations/$db" ]; then
sql_files=$(find migrations/$db -name "*.sql" -type f)
if [ -z "$sql_files" ]; then
echo "❌ No .sql files found in migrations/$db"
exit 1
fi
echo "✅ Found migration files in migrations/$db"
fi
done

echo "✅ All migration files validated"

- name: Summary
if: always()
run: |
echo "## Migration Check Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.check_models.outputs.models_changed }}" = "true" ]; then
echo "- 🔄 GORM models were modified" >> $GITHUB_STEP_SUMMARY

if [ "${{ steps.check_migrations.outputs.migrations_changed }}" = "true" ]; then
echo "- ✅ Migration files were updated" >> $GITHUB_STEP_SUMMARY
else
echo "- ℹ️ No migration files changed (no schema impact)" >> $GITHUB_STEP_SUMMARY
fi
else
echo "- ℹ️ No GORM model changes detected" >> $GITHUB_STEP_SUMMARY
fi

echo "" >> $GITHUB_STEP_SUMMARY
echo "### How to generate migrations" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "cd taco" >> $GITHUB_STEP_SUMMARY
echo "make atlas-diff-all name=descriptive_name" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

Loading
Loading