Reputation: 77
I believe database migrations are related to the objects of the database like tables, views, data etc.
Can we add / edit users and change their login passwords as part of the migration with flyway ? Is it a considered best practice?
Upvotes: 1
Views: 2729
Reputation: 2155
Yes, anything that is valid SQL can be run in a migration.
However, the usual use case for Flyway is that migration scripts are stored somewhere permanent so that you have a trail of how the database got to its current state. You will need to take care that credentials are not accidentally exposed in source control (including history), collections of migration scripts on build servers, or anywhere else.
Upvotes: 3
Reputation: 2755
According to the Flyway docs:
SQL-based migrations are typically used for
- DDL changes (CREATE/ALTER/DROP statements for TABLES,VIEWS,TRIGGERS,SEQUENCES,…)
- Simple reference data changes (CRUD in reference data tables)
- Simple bulk data changes (CRUD in regular data tables)
So yes the migrations can contain DML as well DDL.
Upvotes: 2