5
votes

I'd like to introduce flyway on an existing production database. I've read https://flywaydb.org/documentation/existing but I'd like to skip the step "Take a DDL and reference data extract from production"

Let me explain why:

  • I am planing to have a more close to production data DB in DEV so I'll take a PROD dump, anonymize customer releated data and have it on DEV

When having the same schema from PROD in DEV flyway will be used for migration. My approach is to start flyway with flag baselineOnMigrate so the houskeeping table "flyway_schema_history" is automatically created.

I know the disadvantage is that a DB cannot be created from scratch by flyway but besides it should work out.

I did a test with some scripts flyway_schema_history and it looks good so far ("success" column shows "1")

My Questions:

  • are the negative checksums ok?
  • when is a checksum negativ, when positive?
  • do you see any problems in this approach?
1
Checksums can be negative as they are calculated using a signed 32-bit integer. Nothing special. - Axel Fontaine
Thanks for answering first two questions! - Martin Dürrmeier

1 Answers

0
votes

You are talking about DDL (data definition language) and in the same sentence you are anonymonize existing data (DML, data modification language). Maybe you mixing up two different things.

Flyways primary goal is to migrate your database from scratch. This means creating, altering and dropping tables and other database objects.

I recommend to

  • extract the DDL from your production database and add it as V1 migration script

  • handle the data insertion and the anonymonizing yourself for the Dev environment.

Hope this helps