question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFE: Add Flyway.truncate()

See original GitHub issue

Original author: jonas.ki…@gmail.com (April 14, 2011 19:23:31)

When running junit (integration) tests, one often wants to empty the database upon @Before in order to start the tests with a clean state. It’s doable like this, albeit very time consuming:

flyway.clean();
flyway.init();
flyway.migrate();

Proposal: add flyway.truncate() to just empty the tables instead of re-creating them.

As homework I leave it to you to think about how not to truncate the masterdata insterted as part of flyway.migrate() before, e.g. earlier in the build process where the database was created initally. Because that data is often needed for tests as well and belongs to the database’s base resp. initial setup.

Want do you think? Maybe specifying an exclusion pattern for tables not to truncate would work for 90% of the time?

_Original issue: http://code.google.com/p/flyway/issues/detail?id=122_

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:5
  • Comments:15

github_iconTop GitHub Comments

5reactions
jean-amanacommented, Jun 17, 2019

Same here, +1

3reactions
amitkumariitdcommented, Jan 7, 2021

Upvote +1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Truncate all tables with flyway - sql - Stack Overflow
1 Answer 1 · Write or adapt a script that truncates all the tables in your database - for simplicity in ordering and...
Read more >
Flyway by Redgate • Database Migrations Made Easy.
Flyway automatically discovers migrations on the filesystem and on the Java classpath. To keep track of which migrations have already been applied when...
Read more >
Clean - Flyway by Redgate • Database Migrations Made Easy.
Clean is a great help in development and test. It will effectively give you a fresh start, by wiping your configured schemas completely...
Read more >
Command-line tool - Flyway by Redgate • Database ...
Docker. (Linux only) Download, extract and install by adding to `PATH` (requires `sudo` permissions): $ sudo sh - ...
Read more >
Release Notes - Flyway by Redgate • Database Migrations ...
Add SQLFluff to redgate/flyway Docker image for use with new integrations ... Issue 2756 Fix performance issue with the MySQLSchema doEmpty() call ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found