How to create a database with flyway?

前端 未结 5 931
执念已碎
执念已碎 2020-12-25 11:55

Question: Is it possible to create a new DB in a migration script and then connect to it? How?

My Scenario: I\'m trying to use flyw

5条回答
  •  不知归路
    2020-12-25 12:56

    If u have schema database creation command in V1 of your scripts, flyway can generate it but not database:

    flyway -baselineOnMigrate=true -url=jdbc:mysql://localhost/ -schemas=test_db -user=root -password=root_pass -locations=filesystem:/path/to/scrips/ migrate
    

    and similar to this in the script file:

    DROP SCHEMA IF EXISTS `test_db` ;
    CREATE SCHEMA `test_db` COLLATE utf8_general_ci ;
    

提交回复
热议问题