1

I have baselined my existing database with a V1__Base_version.sql. Now, when I run migrate and have files like V2__Migration_842.sql and V3__Migration_842.sql, my V1__Base_version.sql gets executed again and fails with the following message :

PS: I rename the .sql files during my build appending a timeStamp to it so no 2 developers get the same file name after checking-in.

Migration 20170401092116374__V1__Base_version.sql failed -------------------------------------------------------- SQL State : 42P07 Error Code : 0 Message : ERROR: relation "address_space" already exists Location : /Users/code/main/migration/resources/sql/20170401092116374__V1__Base_version.sql (/Users/code/main/migration/resources/sql/20170401092116374__V1__Base_version.sql) Line : 33 Statement : CREATE TABLE address_space ( id character varying(32) NOT NULL, address_type character varying(255) NOT NULL, last_modified_timestamp timestamp without time zone ) }]

My baseline succeeds with the following message :

  • Creating Metadata table: "public"."schema_version"
  • Successfully baselined schema with version: 1
  • Current version of schema "public": 1
  • Migrating schema "public" to version 20170401092116374 - V1 Base version

Should not the migrate ignore the 20170401092116374__V1__Base_version.sql? I have set the BaselineOnMigrate and ValidateOnMigrate flags to false.

The 3 .sql file names after the build are as follows :

  1. 20170401092116374__V1__Base_version.sql
  2. 20170512102926635__V2__Migration_for_8_4_3.sql
  3. 20170531164538687__V3__Migration_843.sql

What is that I am missing here???

Thanks

Raja
  • 101
  • 1
  • 7
  • Can someone help??? – Raja Jun 01 '17 at 21:14
  • I started having the same issue today after changing the contents of the `V1__Base_version.sql` file. A developer ran a migration manually between baselining and running any migrations in production, so I updated the baseline file with the latest schema dump. This same issue is occurring. I started using flyway on an existing schema, so did not create the schema from the baseline. I have the same flags as OP set to false. – w2bro Jun 20 '17 at 16:38

0 Answers0