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.

Found more than one migration with version n (after switching from version 7.11.4 to the latest)

See original GitHub issue
Which version and edition of Flyway are you using?

7.12.0

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)

same problem with 7.15.0

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Maven plugin

Which database are you using? (Type & version)

PostgreSql 42.2.23 (production) and H2 1.4.200 (testing)

Which operating system are you using?

Windows

What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)

This is one of many integration tests that fail.

@SpringBootTest
@Transactional
class CatalogControllerTest {

	@Autowired
	private WebApplicationContext applicationContext;
	@Autowired
	private aRepository aRepository;
	private MockMvc mockMvc;

	@BeforeEach
	void setup() {
		this.mockMvc = MockMvcBuilders .webAppContextSetup(applicationContext).build();
	}

	@Test
	void get_OK() throws Exception {

		aRepository.save(anyDTO);

		this.mockMvc.perform(
				get("endpoint/...")
			.andExpect(status().isOk());
	}

}

NOTE up to version 7.11.4 I didn’t have any problems

What did you expect to see?

I expected flyway to perform migrations correctly

What did you see instead?

I received the following exception:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class
path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init 
method failed; nested exception is org.flywaydb.core.api.FlywayException: Found more than one migration with version 1
Offenders:
-> ...\target\classes\db\migration\V1__table.sql (SQL) 
-> ...\target\test-classes\db\migration\V1__table.sql (SQL) (override)

For reasons of compatibility with H2, I need to override some scripts in the folder test/resources/db/migrations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DoodleBobBuffPantscommented, Dec 20, 2021

Likely related to https://github.com/flyway/flyway/issues/3359#issuecomment-998164826 where the same suggested solution will apply

0reactions
dinaantcommented, Dec 20, 2021

This you see below is the only configuration class

@Component
public class FlywayRunner {
    
    public FlywayRunner(@Value("${spring.datasource.url}") String url,
						@Value("${spring.datasource.username}") String username,
						@Value("${spring.datasource.password}") String password) {
		
      final var flyway = Flyway.configure()
        		.dataSource(url , username , password)
        		.load();

        try {
        	flyway.migrate();
        } catch (Exception e) {		
		flyway.repair();
	}
    }

}

We use the default flyway folder as the location. Maybe I should add something to the configuration file?

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flyway Found more than one migration with version
The Flyway locations property needs a {vendor} placeholder, then Spring Boot will work out the directory from the lowercase of the database ...
Read more >
Release Notes for Flyway Engine - Documentation
Breaking changes. Migration patterns that are version numbers are treated as numbers rather than strings when matching to migrations; Script & ...
Read more >
Issue 94 in flyway: "Found more than one migration" error for ...
In such a case, Flyway complains: Found more than one migration with version: X at com.googlecode.flyway.core.migration.MigrationProvider.
Read more >
Confluence 7.11 Upgrade Notes - Atlassian Documentation
If your version of Confluence is more than one version behind, read the release notes and upgrade guides for all releases between your...
Read more >
2.16. Version 6.4 - Documentation
This Squish version introduces a new, more powerful scheme for expressing and managing object names: Script-Based Object Maps. Instead of using strings ...
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