Note that there are some explanatory texts on larger screens.

plurals
  1. POFlyway:init doesn't create schema database
    text
    copied!<p>I'm using flyway to manage a multi-schema database in mysql and I've configured flyway using Maven. I have listed a database called 'metadata' as the first in the <code>&lt;schemas&gt;</code> tag so flyway will put the <code>schema_version</code> table here. When I run <code>mvn flyway:migrate</code> I'm expecting this table <strong>and the <code>metadata</code></strong> database to be created. Flyway 2.1.1 tries to create the table, but does not create the database first so it fails.</p> <pre> [DEBUG] Schemas: metadata,temp,OTHER_DBS_REDACTED [DEBUG] Schema `temp` already exists. Skipping schema creation. [DEBUG] Database: MySQL 5.6 [ERROR] com.googlecode.flyway.core.api.FlywayException: Error setting current sc hema to `metadata` [ERROR] Caused by com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unk nown database 'metadata' </pre> <p>I thought <code>mvn flyway:init</code> might create the schemas, but that fails with a different but obviously related error.</p> <pre> [INFO] --- flyway-maven-plugin:2.1.1:init (default-cli) @ database --- [INFO] Creating Metadata table: `metadata`.`schema_version` [ERROR] com.googlecode.flyway.core.api.FlywayException: Error executing statement at line 17: CREATE TABLE `metadata`.`schema_version` ( `version_rank` INT NOT NULL, `installed_rank` INT NOT NULL, `version` VARCHAR(50) NOT NULL, `description` VARCHAR(200) NOT NULL, `type` VARCHAR(20) NOT NULL, `script` VARCHAR(1000) NOT NULL, `checksum` INT, `installed_by` VARCHAR(100) NOT NULL, `installed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `execution_time` INT NOT NULL, `success` BOOL NOT NULL ) ENGINE=InnoDB [ERROR] Caused by com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'metadata' </pre> <p>If I <code>create database metadata</code> then things proceed smoothly. I'm quite enjoying flyway in fact. Short of running some sql manually, is there a way to make flyway create this database? Is this simply a bug?</p> <p>TIA</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload