Migrate Schema with Flyway
On this page
You can integrate Flyway into your SingleStoreDB cluster to manage schema changes in your database using the natively integrated SingleStore driver.
Integration with SingleStoreDB is supported in Flyway version 9.
An active SingleStoreDB cluster.
Install the Teams Edition of Flyway command-line.
To integrate Flyway into your SingleStoreDB cluster, you need to update the connection parameters for your cluster and the Flyway license key in the Flyway configuration file (flyway.
Here's a sample configuration:
Refer to connection string parameters for more information on the supported parameters.
Flyway migrations are defined in
. files located in the /<flyway-installation>/sql/ directory.
. files using the
The following example shows how to perform a SQL-based migration using Flyway.
.file in the /<flyway-installation>/sql/ directory, say V1_
sql Create_ table_ example. sql, and add the following SQL statement:CREATE TABLE example (ID INT NOT NULL,Name VARCHAR(100) NOT NULL);
migratecommand in the /<flyway-installation> directory to apply the changes:flyway migrate
Successfully validated 1 migration (execution time 00:00.020s) Creating Schema History table `dbTest`.`flyway_schema_history` ... Current version of schema `dbTest`: << Empty Schema >> Migrating schema `dbTest` to version "1 - Create table example"
The database is now migrated to version 1.
.file, say V2_
sql Add_ column. sql, and add the following SQL statement:ALTER TABLE example ADD COLUMN Trn DATE;
Successfully validated 2 migrations (execution time 00:00.023s) Current version of schema `dbTest`: 1 Migrating schema `dbTest` to version "2 - Add column" Successfully applied 1 migration to schema `dbTest`, now at version v2
This command validates and runs both the migrations, and the database is now migrated to version 2.
Last modified: September 27, 2023