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.

Generate "src/main/resources/db/migration" structure for Flyway projects

See original GitHub issue

Out-of-the-box, the ApplicationTests.contextLoads() test will fail with a generated project that uses Flyway because there’s no default migration file.

Adding an empty V1__init.sql file into the resources/db/migration directory would make that test pass and be a nicer experience.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
wilkinsonacommented, Jan 10, 2019

That sounds reasonable to me. On the Boot side, perhaps we should consider some failure analysis for the exception that Flyway throws as well?

0reactions
tedyoungcommented, Jan 10, 2019

So it looks like Boot is the one complaining as part of autoconfigure (see https://github.com/spring-projects/spring-boot/blob/2.1.x/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java#L191)

For adding Flyway to an existing Boot project that already has database schemas, etc., that check makes sense, but for a newly generated project, it’s confusing (“how can I write a migration when I don’t have any code yet?”). I feel like there needs to be better guidance, though I agree that generating an empty migration, which then has to be modified or thrown away, might not be best.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate "src/main/resources/db/migration" structure ... - GitHub
contextLoads() test will fail with a generated project that uses Flyway because there's no default migration file.
Read more >
Organising your Migrations - Flyway
Wildcards in practice. Release folder based structure. A common working pattern we have seen is to structure your migrations into 'releases'.
Read more >
Creating a new project - Flyway - Product Documentation
A project in Flyway Desktop allows you to track changes to a development database and generate migration scripts that can be versioned ...
Read more >
Database Migrations with Flyway - Baeldung
To generate a differential versioned migration, simply install the plugin and call the action from the JPA Structure panel. We simply select ...
Read more >
Database migration with Flyway in large project | Novatec
The following diagram illustrates the scripts in different increment. ... When a sprint ends, our jenkins release build packs the Flyway ...
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