rollback ci script#760
Open
OmniZlatoon wants to merge 1 commit into
Open
Conversation
|
@OmniZlatoon is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@OmniZlatoon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
|
Hello maintainer, I have completed the task. Please review |
Author
|
good morning maintainer, I have completed the task. please review PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Database Migration Rollback Checker Implementation
This walkthrough outlines the changes made to introduce an automated CI testing script that verifies the safe rollback of database migrations in the Web3 Student Lab project.
Overview of Changes
To ensure database schema integrity post-rollback, the CI pipeline is now configured to test if the latest database migration can execute a clean rollback loop without data corruption or dangling schema artifacts.
1. Rollback Test Script (backend/scripts/test-migration-rollback.sh)
Since Prisma does not natively generate or store down.sql scripts, we introduced a bash script to dynamically simulate the rollback process:
It creates a temporary directory simulating the previous migration state (N-1).
It migrates the test database to the latest state (N).
It uses npx prisma migrate diff to compare the N state with the N-1 state and generates a dynamic down.sql script to undo the latest changes.
It executes the down.sql via npx prisma db execute.
It performs a final verification check using npx prisma migrate diff --exit-code to ensure the current database schema accurately matches the schema of the N-1 state.
2. NPM Script (backend/package.json)
A new script "test:migrations" was added to execute the bash script:
json
"test:migrations": "bash scripts/test-migration-rollback.sh"
3. CI Pipeline Integration (.github/workflows/ci.yml)
The GitHub Actions workflow for the backend was updated to invoke this script. The Test Migration Rollbacks step is strategically placed after the initial Prisma Generate & Migrate step.
closes #742