# Migration failure : liquibase.exception.DatabaseException: Table 'alert' already exists

**URL:** <https://forum.liquibase.org/t/migration-failure-liquibase-exception-databaseexception-table-alert-already-exists/4992>\
**Category:** General Discussion\
**Created:** [January 25, 2021, 2:44pm UTC](https://forum.liquibase.org/t/migration-failure-liquibase-exception-databaseexception-table-alert-already-exists/4992 "2021-01-25T14:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adiltst](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@Adiltst](https://forum.liquibase.org/u/Adiltst)\
**Post date:** [January 25, 2021, 2:44pm UTC](https://forum.liquibase.org/t/migration-failure-liquibase-exception-databaseexception-table-alert-already-exists/4992/1 "2021-01-25T14:44:23Z")

</div>

Hi everyone,

I need to add liquibase to an existing spring-boot project for my job, on a MYSQL database.  
I followed this tutorial : [https://www.baeldung.com/liquibase-refactor-schema-of-java-app](https://www.baeldung.com/liquibase-refactor-schema-of-java-app)  
I simply ran an `mvn liquibase:generateChangelog` command to generate the init changelog of my database.

Once it was done :  
I tried to run “mvn liquibase:update” on command line, and everything was working fine, with this messages :

But when I try to run my app with the auto-update enabled with the `mvn spring-boot:run` command, I face this error :

```
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/xml/changelog_1.xml::1611571499468-1::W100553 (generated):
 Reason: liquibase.exception.DatabaseException: Table 'alert' already exists [Failed SQL: (1050) CREATE TABLE alerttest.alert ...

```

I don’t understand why since everything work fine when I run an update on CLI.

Here is my pom :

```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.1</version>
		<relativePath/>
		<!-- lookup parent from repository -->
	</parent>
	<groupId>com.example.testliquibase</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
	<description>Demo project for Spring Boot with liquibase</description>

	<properties>
		<java.version>8</java.version>
	</properties>

	<dependencies>

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.22</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-core</artifactId>
			<version>4.2.2</version>
		</dependency>

		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-maven-plugin</artifactId>
			<version>3.4.1</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.liquibase</groupId>
				<artifactId>liquibase-maven-plugin</artifactId>
				<version>3.4.1</version>
				<configuration>
					<propertyFile>src/main/resources/db/changelog/application.yml</propertyFile>
					<changeLogFile>src/main/resources/db/changelog/changelog_master.xml</changeLogFile>
					<driver>com.mysql.cj.jdbc.Driver</driver>
				</configuration>
			</plugin>

		</plugins>
	</build>

</project>

```

Here is my application.properties :

```
url=jdbc:mysql://localhost:3306/alerttest?zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC
username=
password=
spring.liquibase.change-log=classpath:db/changelog/changelog_master.xml
spring.liquibase.enabled=true
logging.level.web=DEBUG
spring.datasource.url=jdbc:mysql://localhost:3306/alerttest?zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC
spring.datasource.username=
spring.datasource.password=

```

And finally, my changelog master :

```
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
   <include file="xml/changelog_1.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

```

Thanks for your help, I have no clue how to solve this…

---

<div class="post-metadata">

**Author:** ![Adiltst](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@Adiltst](https://forum.liquibase.org/u/Adiltst)\
**Post date:** [January 26, 2021, 10:13am UTC](https://forum.liquibase.org/t/migration-failure-liquibase-exception-databaseexception-table-alert-already-exists/4992/2 "2021-01-26T10:13:58Z")

</div>

I resolved this : version of liquibase plugin and liquibase-code were not the same : so the calculated hash was not equals to the one generated with liquibase update.  
Be careful to use the same version of plugin and dependancy in maven, and be careful with the path of your files : the hash is calculated with the path of your files.

---

<div class="post-metadata">

**Author:** ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)\
**Post date:** [January 27, 2021, 7:03pm UTC](https://forum.liquibase.org/t/migration-failure-liquibase-exception-databaseexception-table-alert-already-exists/4992/3 "2021-01-27T19:03:18Z")

</div>

Welcome to the Liquibase community! Thanks so much @Adiltst for sharing how you solved the issue. Yes there have been changes to the hashing algorithm in the past.
