I have recently started using the baseline and repeatable migrations in my app. Although I don't seem to be using any teams-edition features, yet flyway somehow switches automatically to the Teams edition instead of Community edition, and shows a message :
Flyway Teams Edition 8.2.0 by Redgate
Flyway Teams features are enabled by default for the next 27 days. Learn more at https://rd.gt/3A4IWym
Previously we had eight versioned migrations V1__xxxx.sql to V8__xxxx.sql
Now we have made the following changes :
All the eight migrations, plus some other init scripts have been combined into a single migration V1__seed-data.sql
Repeatable migrations have been put into R__xxxx.sql
Some placeholders have been placed into the flyway.conf like : fileflyway.placeholders.app_db_name=${APP_DB_NAME}
For our existing Production DB, which was already migrated till V8, we have Dropped the flyway_schema_history table and used the "flyway baseline" command with an environment variable FLYWAY_BASELINE_VERSION=1
After this, the flyway_schema_history shows us this result :
But after these changes, we are seeing the "Teams edition" message as above.
Earlier it used to show :
Flyway Community Edition 8.2.0 by Redgate
I am quite sure looking at the flyway documentation that we haven't used any Teams edition features. https://flywaydb.org/documentation/usage/commandline/baseline
Now I have 2 questions :
What caused flyway to switch to Teams edition without teams features being used?
What happens once the trial period ends? Does flyway block all our migrations in the future unless we buy the license?
Update Flyway to the latest version; the "Auto trial" feature created the "Teams edition" message you're seeing here, and was removed in Flyway 8.4.3 - release notes.
Related
We have a production system with a large DB (several hundred tables) and would like to begin using Flyway to manage DDL changes that occur through the dev cycle. However, the organization is setup in such a way that there are production DB changes that sometimes occur, mostly just data changes but possibly DDL, that will happen outside of a data migration tool. While this is obviously an organizational challenge, does this fact alone cripple a tool like Flyway? Or is there a workflow where Flyway could rebuild its indices on demand such that any out-of-band DB change like this is pulled in?
We'd love to use Flyway, but would need to integrate it incrementally until all teams using the system are trained/bought in.
When introducing Flyway to a DB with existing data you will need to baseline Flyway to integrate with your existing data. See baseline.
For changes made after this, Flyway will only track and version changes made from its own migration scripts and not changes made externally to it. However, this does not mean you cannot use the two together, but you would need to be more aware of your database structure to avoid conflicts between your flyway migrations and external changes.
Transactional data changes made to production shouldn't impact Flyway as these won't be versioned.
If you're referring to static data (eg lookup data) that you'd like Flyway to manage, then this isn't detected by Flyway (at least not today). If you discover that you have drift you'll need to add the changes as a new migration script using idempotent syntax to ensure that next time this runs against production it doesn't try to make the same changes again.
For out-of-band schema changes, The enterprise edition of Flyway has a drift check, so at least you'd be made aware of them. However, as for the data changes described above, you'll need to manually add these schema changes as an idempotent migration script.
I'd like to be able to deploy to my database after a deployment failure, because in my case I am dealing with concurrent and independent deployments.
the flyway clean command helps to remove failed migrations in the migration table. Using that command helps as my future deployments will be executed but the downside is that I lose the history of failed deployments.
Is there a way to tell flyway to repair the migration table and keep the history of failed deployments - say put the success flag to '2' for example.
In my case all deployments are independents so we create unique migration numbers at deployment time - this allows us to redeploy anything without consideration of flyway's status (we re only using the automation mechanism provided with flyway and have disabled other 'migration' safeguards).
This isn't supported natively. I agree that removing the history of failed migrations would be handy to have as an option.
Use of the callbacks may give you a workaround. Specifically you could take a copy of failed migrations in the beforeRepair callback. If using SQL files make a beforeRepair.sql (or whatever you have for your migration suffix).
My current project has a few Flyway migrations in place that are used to import initial data into a database. This data is convenient especially for developers to be able to quickly setup the project. Production data is imported through some batch jobs and has a newer version.
Some of these migrations are quite big (~20MB) and so everytime the application starts, Flyway takes some time to calculate the checksum of the migrations. This also is a problem for integration tests as they also take longer because of this.
I consider this approach to be a misuse of Flyway, I think migration tools should be used mainly for structural data.
I want to remove those files from our application and rather use a configuration management tool (e.g. Vagrant, Puppet, Chef) to import test data on developer environments. However, I can't just delete the migration files from the application as Flyway will complain that a migration has been recorded in the database but is not present in the application migrations.
My first thinking was to create a new migration with a high-priority version number that will
Delete the test data
Delete the migration from the schema_version table
and then remove the migration scripts. This however does not work, Flyway still complains that the removed migration script is missing.
Is there a restriction that you cannot interact with the schema_version table in migrations?
What other options do I have? If at all possible I want to do this using Flyway and not manually.
Repair is your best bet. Empty those data migrations and run the repair command to have their checksums recalculated based on the empty files.
We have a customer with a IT-department that insist on getting database updates as scripts prior to upgrades (they want to "read" the updates before implementing them).
Being an avid user of flyway it made me think about a way of generating a script from flyway based on updates and send this script to IT. This script would at the very least need to create version table if non-existant, check version and apply needed updates. It would of course be proprietary to database vendor (in my case Oracle).
This would allow us to run updates with flyway automatically in development environments and create manual scripts for test and production.
Are anyone aware of something like that having been contemplated or endeavored before? Would it be trivial or a momentous task?
We had this exact problem when I worked at a consultancy (Intelliware) so the devs there put together some code and pushed it up to GitHub.
We tried unsuccessfully to get it included into the Flyway core repo.
https://github.com/Intelliware/flyway-script-generator
Does anyone have any best practices around deploying database changes in an EF 4.1 code-first solution? I know MS does not currently support database migrations for EF 4.1, but obviously people are going to need to do this from time to time.
Thanks
Once you deployed database to production you must do incremental changes. It means that before you deploy next version you must prepare two databases in your dev box:
Database with DB schema currently deployed in production - you should be able to get this from source control so always correctly label / tag your production releases
Database with new DB schema
Once you have two databases you can use some tool to make difference SQL script for you. I have experience with both:
Visual Studio 2010 Premium / Ultimate Database tools
Red Gate SQL Compare
These tools are for SQL server.
Once you have difference script you can test it on your dev box. Be aware that some more complicated changes cannot be created by difference script and require you to create custom migration script for example with storing data existing data in temporary tables while refactoring real table. Also if you use some new seed data in your new version you must add them manually into script or use Data Compare tools (also offered by both products).
After that you can plan outage of your production application, database backup and running upgrade script.