![]() Owner_id integer REFERENCES owners (owner_id),ĬONSTRAINT animal_key PRIMARY KEY (animal_id)įinally, commit the files and push the feature branch to the GitHub repository. Shelter integer REFERENCES organizations (org_id), Paste the following SQL into the file, save and run in your local database: CREATE TABLE animals ( Create a new file in the migrations directory named “V1.2_update_animal_schema.sql”. ![]() Let’s create another SQL migration script with an updated version number. Remember Flyway has specific requirements for the name of the file. Paste the following SQL into the file and save: CREATE TABLE organizations (ĬONSTRAINT owner_id PRIMARY KEY (owner_id)Ĭonnect to your local postgres database in Azure Data Studio and run the above SQL script. Second, the naming convention for the SQL files must follow Flyway’s syntax.Ĭreate a directory in your local git project folder called “migrations”.Ĭreate a new file in the migrations directory named “V1.1_create_animal_schema.sql”. First, the files containing the SQL for the schema changes must be saved in the same folder. In order to use Flyway to automatically migrate the schema changes to the databases in the stage and production environments there are a few key requirements. Step 1: Create a GitHub and local projectĬreate a new repository in GitHub and clone the repository to your local machine.Ĭreate a feature branch, for example git checkout -b feature/animal-schema Step 2: Create a table in the local database This example uses GitHub and GitHub Actions to manage the pipeline, but the concepts could work with other git hosting and CI/CD services.
0 Comments
Leave a Reply. |