Skip to content

This repository offers a streamlined solution for performing database migrations using the flyway tool, independent of your main code base. This approach ensures a smooth, efficient, and optimized process for managing your database migrations.

License

Notifications You must be signed in to change notification settings

TheCodersStudio/flyway-migrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flyway-Migrator: Database Migration

This is an example repository that demonstrates how to set up automated database migrations using Flyway and GitHub Actions

Flyway is a popular database migration tool that can be easily integrated with GitHub Actions to automate your migration process.

🚀 Getting started

To get started with this example, you'll need to have the following:

  • A PostgreSQL database
  • Flyway installed on your local machine
  • A GitHub account

⚙️ Setting up Flyway

Before you can use Flyway, you'll need to download it and configure it with your database connection details. You can download Flyway from the official website: https://flywaydb.org/download/.

Once you've downloaded and installed Flyway, you'll need to update a configuration file (flyway.conf) in /conf directory with appropriate values as per your database setup.

🏃‍♂️ Run

Clone this repository

git clone [email protected]:Chetan07j/flyway-migrator.git

Enter into directory

cd flyway-migrator

Migrate

You can execute the following command to run migration scripts and set the schema to the latest version:

flyway -configFiles="./conf/flyway.conf" migrate

GitHub Action

GitHub Action workflow_dispatch event allows you to manually trigger a workflow from the GitHub Actions tab. It provides a way to run workflows without pushing any changes to the repository.

After adding the migration script to the sql directory in this repository, you can easily run the GitHub Action to execute those migrations in any location you specify.

An additional step is included in the Action file, which saves the output of flyway info command into a text file with a filename containing a timestamp, and then places that file under the migration-status directory.

🔗 References

🙋‍♂️ Support

💙 If you like this project, give it a ⭐

About

This repository offers a streamlined solution for performing database migrations using the flyway tool, independent of your main code base. This approach ensures a smooth, efficient, and optimized process for managing your database migrations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published