Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway introduction on existing db

Tags:

flyway

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?
like image 478
Martin Dürrmeier Avatar asked Nov 17 '22 21:11

Martin Dürrmeier


1 Answers

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

like image 164
saw303 Avatar answered Apr 13 '23 00:04

saw303