There are serveral approaches to the database table migration.
This project introduces one of the approach, GitOps with AWS CDK by leveraging sqldef.
sqldef is a idempotent schema management tool. So it has a high affinity for GitOps.
You can use this project as a skeleton so that acquire the maintainable table migration from the beginning.
Install the dependencies
npm installBootstrap CDK (Skip if you already did it.)
npx cdk bootstrapDeployment
npx cdk deployAfter the deployment, push this code to AWS CodeCommit. The CodeCommit repository was created by the deployment above. Read Setup for HTTPS users using Git credentials.
The git push will trigger the AWS Step Functions execution.
Visit StateMachine and confirm the AWS CodeBuild execution logs.
Modify /sql/tables.sql to add new table or new columns.
Then push the code again to trigger the new execution.
You can confirm that the new ALTER query is applied to the database.
Database-related CI/CD may require complex CI/CD flows in the future, including rollback and adaptation to staging environments. CodePipeline can also be used in the current CI/CD flow.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
