Test reversibility of migrations #220

Merged
bustikiller merged 35 commits from test-rollbacks into main 2025-01-25 09:43:43 +00:00
Showing only changes of commit ac470a802b - Show all commits

View File

@ -34,6 +34,12 @@ jobs:
sleep 1
echo "Trying again"
done
- run: |
bundle exec rake db:schema:load
bundle exec rspec
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
- name: Get all migrations added
id: changed-migration-files
uses: tj-actions/changed-files@v45
@ -45,18 +51,13 @@ jobs:
env:
ALL_CHANGED_FILES: ${{ steps.changed-migration-files.outputs.all_changed_files }}
run: |
echo ${#ALL_CHANGED_FILES[@]}
echo ${#ALL_CHANGED_FILES[@]} migrations changed:
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- run: |
exit 1
bundle exec rake db:schema:load db:migrate:status db:migrate:redo
bundle exec rake db:migrate:redo STEP=${#ALL_CHANGED_FILES[@]}
git diff --exit-code db/schema.rb
bundle exec rspec
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
- name: Clean up containers generated by this flow
if: failure()
run: docker ps --filter network=$JOB_CONTAINER_NAME-$GITHUB_JOB-network --filter name=$JOB_CONTAINER_NAME-* --format "{{.ID}}" | xargs docker rm -f