Ree6-Applications / Ree6

All-in-one, open source and 100% free Discord Bot!
https://ree6.de
GNU General Public License v3.0
145 stars 39 forks source link

[Bug]: Flyway fails migration on SQLite databases. #467

Closed CloudGirlS closed 7 months ago

CloudGirlS commented 1 year ago

Contact Details

cloudbeast1@gmail.com

What happened?

A bug happened! when i start server these happend: 21:31:53.286 [main] INFO o.f.core.internal.command.DbMigrate - Migrating schema "main" to version "1 - Initial" 21:31:53.318 [main] ERROR o.f.core.internal.command.DbMigrate - Migration of schema "main" to version "1 - Initial" failed! Changes successfully rolled back. 21:31:53.320 [main] ERROR de.presti.ree6.main.Main - Shutting down, because of an critical error! org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V1__Initial.sql failed

Version

v3 (Current)

Relevant log output

21:31:41.222 [main] INFO  de.presti.ree6.main.Main - Creating Sentry Instance. 
21:31:41.340 [main] INFO  de.presti.ree6.main.Main - Starting preparations of the Bot... 
21:31:41.343 [main] INFO  d.p.ree6.language.LanguageService - Created the language folder! 
21:31:42.746 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: bg 
21:31:42.933 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: bg 
21:31:42.934 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: cs 
21:31:42.974 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: cs 
21:31:42.974 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: de 
21:31:43.010 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: de 
21:31:43.011 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: en-GB 
21:31:43.040 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: en-GB 
21:31:43.041 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: id 
21:31:43.069 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: id 
21:31:43.070 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: pl 
21:31:43.104 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: pl 
21:31:43.104 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: ru 
21:31:43.138 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: ru 
21:31:43.139 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: tr 
21:31:43.167 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: tr 
21:31:43.168 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: uk 
21:31:43.202 [main] INFO  d.p.ree6.language.LanguageService - Downloaded Language: uk 
21:31:44.243 [main] INFO  de.presti.ree6.main.Main - Downloading file timer.mp3! 
21:31:44.428 [main] INFO  de.presti.ree6.main.Main - Downloading file base.png! 
21:31:44.560 [main] INFO  de.presti.ree6.main.Main - Finished preparations of the Bot! 
21:31:44.561 [main] INFO  de.presti.ree6.main.Main - Starting Ree6! 
21:31:44.836 [main] INFO  org.reflections.Reflections - Reflections took 237 ms to scan 1 urls, producing 3 keys and 3 values 
21:31:44.911 [main] INFO  de.presti.ree6.sql.SQLConnector - Connecting to SQl-Service (SQL). 
21:31:44.921 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 
21:31:45.142 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@744199bb 
21:31:45.148 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 
21:31:45.148 [main] INFO  de.presti.ree6.sql.SQLConnector - Service (SQL) has been started. Connection was successful. 
21:31:45.304 [main] INFO  o.f.c.i.license.VersionPrinter - Flyway Community Edition 9.22.3 by Redgate 
21:31:45.304 [main] INFO  o.f.c.i.license.VersionPrinter - See release notes here: https://rd.gt/416ObMi 
21:31:45.305 [main] INFO  o.f.c.i.license.VersionPrinter -  
21:31:45.373 [main] INFO  org.flywaydb.core.FlywayExecutor - Database: jdbc:sqlite:storage/Ree6.db (SQLite 3.43) 
21:31:45.445 [main] INFO  o.f.c.i.s.JdbcTableSchemaHistory - Schema history table "main"."flyway_schema_history" does not exist yet 
21:31:45.465 [main] INFO  de.presti.ree6.sql.SQLConnector - Found 2 pending migrations. 
21:31:45.468 [main] INFO  de.presti.ree6.sql.SQLConnector - The pending migrations are: Initial, Add Giveaway 
21:31:45.468 [main] INFO  de.presti.ree6.sql.SQLConnector - Running Flyway Migrations. 
21:31:45.481 [main] INFO  o.f.c.i.s.JdbcTableSchemaHistory - Schema history table "main"."flyway_schema_history" does not exist yet 
21:31:45.485 [main] INFO  o.f.c.internal.command.DbValidate - Successfully validated 2 migrations (execution time 00:00.007s) 
21:31:45.493 [main] INFO  o.f.c.i.s.JdbcTableSchemaHistory - Creating Schema History table "main"."flyway_schema_history" ... 
21:31:45.541 [main] INFO  o.f.core.internal.command.DbMigrate - Current version of schema "main": << Empty Schema >> 
21:31:45.602 [main] INFO  o.f.core.internal.command.DbMigrate - Migrating schema "main" to version "1 - Initial" 
21:31:45.629 [main] ERROR o.f.core.internal.command.DbMigrate - Migration of schema "main" to version "1 - Initial" failed! Changes successfully rolled back. 
21:31:45.631 [main] ERROR de.presti.ree6.main.Main - Shutting down, because of an critical error! 
org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V1__Initial.sql failed
--------------------------------
SQL State  : null
Error Code : 1
Message    : [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
Location   : sql/migrations/V1__Initial.sql (/home/container/file:/home/container/Ree6.jar!/sql/migrations/V1__Initial.sql)
Line       : 405
Statement  : ALTER TABLE Money_Transaction
    ADD CONSTRAINT FK_MONEY_TRANSACTION_ON_RECEIVER FOREIGN KEY (receiver) REFERENCES Money_Holder (Id)

    at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:382)
    at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:272)
    at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55)
    at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:271)
    at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244)
    at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:139)
    at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate$1.call(TableLockingExecutionTemplate.java:36)
    at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55)
    at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate.execute(TableLockingExecutionTemplate.java:31)
    at org.flywaydb.core.internal.database.base.Connection.lock(Connection.java:102)
    at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:144)
    at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:139)
    at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:97)
    at org.flywaydb.core.Flyway.lambda$migrate$0(Flyway.java:188)
    at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:213)
    at org.flywaydb.core.Flyway.migrate(Flyway.java:140)
    at de.presti.ree6.sql.SQLConnector.runMigrations(SQLConnector.java:115)
    at de.presti.ree6.sql.SQLConnector.<init>(SQLConnector.java:59)
    at de.presti.ree6.sql.SQLSession.<init>(SQLSession.java:179)
    at de.presti.ree6.main.Main.main(Main.java:207)
Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Migration V1__Initial.sql failed
--------------------------------
SQL State  : null
Error Code : 1
Message    : [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
Location   : sql/migrations/V1__Initial.sql (/home/container/file:/home/container/Ree6.jar!/sql/migrations/V1__Initial.sql)
Line       : 405
Statement  : ALTER TABLE Money_Transaction
    ADD CONSTRAINT FK_MONEY_TRANSACTION_ON_RECEIVER FOREIGN KEY (receiver) REFERENCES Money_Holder (Id)

    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:267)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:222)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:68)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:57)
    at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:56)
    at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:374)
    ... 19 common frames omitted
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
    at org.sqlite.core.DB.newSQLException(DB.java:1179)
    at org.sqlite.core.DB.newSQLException(DB.java:1190)
    at org.sqlite.core.DB.throwex(DB.java:1150)
    at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
    at org.sqlite.core.NativeDB.prepare(NativeDB.java:132)
    at org.sqlite.core.DB.prepare(DB.java:264)
    at org.sqlite.jdbc3.JDBC3Statement.lambda$execute$0(JDBC3Statement.java:53)
    at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:459)
    at org.sqlite.jdbc3.JDBC3Statement.execute(JDBC3Statement.java:42)
    at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
    at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
    at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:201)
    at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:95)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:210)
    ... 25 common frames omitted
21:31:48.753 [main] INFO  de.presti.ree6.main.Main - Creating Sentry Instance. 
21:31:48.857 [main] INFO  de.presti.ree6.main.Main - Starting preparations of the Bot... 
21:31:50.240 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: bg 
21:31:50.413 [main] INFO  d.p.ree6.language.LanguageService - Language file bg already exists! Will compare version! 
21:31:50.632 [main] INFO  d.p.ree6.language.LanguageService - Language file bg is up to date! 
21:31:50.633 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: cs 
21:31:50.667 [main] INFO  d.p.ree6.language.LanguageService - Language file cs already exists! Will compare version! 
21:31:50.762 [main] INFO  d.p.ree6.language.LanguageService - Language file cs is up to date! 
21:31:50.763 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: de 
21:31:50.795 [main] INFO  d.p.ree6.language.LanguageService - Language file de already exists! Will compare version! 
21:31:50.875 [main] INFO  d.p.ree6.language.LanguageService - Language file de is up to date! 
21:31:50.876 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: en-GB 
21:31:50.910 [main] INFO  d.p.ree6.language.LanguageService - Language file en-GB already exists! Will compare version! 
21:31:50.977 [main] INFO  d.p.ree6.language.LanguageService - Language file en-GB is up to date! 
21:31:50.977 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: id 
21:31:51.042 [main] INFO  d.p.ree6.language.LanguageService - Language file id already exists! Will compare version! 
21:31:51.106 [main] INFO  d.p.ree6.language.LanguageService - Language file id is up to date! 
21:31:51.106 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: pl 
21:31:51.137 [main] INFO  d.p.ree6.language.LanguageService - Language file pl already exists! Will compare version! 
21:31:51.206 [main] INFO  d.p.ree6.language.LanguageService - Language file pl is up to date! 
21:31:51.207 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: ru 
21:31:51.238 [main] INFO  d.p.ree6.language.LanguageService - Language file ru already exists! Will compare version! 
21:31:51.295 [main] INFO  d.p.ree6.language.LanguageService - Language file ru is up to date! 
21:31:51.295 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: tr 
21:31:51.324 [main] INFO  d.p.ree6.language.LanguageService - Language file tr already exists! Will compare version! 
21:31:51.380 [main] INFO  d.p.ree6.language.LanguageService - Language file tr is up to date! 
21:31:51.381 [main] INFO  d.p.ree6.language.LanguageService - Downloading Language: uk 
21:31:51.412 [main] INFO  d.p.ree6.language.LanguageService - Language file uk already exists! Will compare version! 
21:31:51.470 [main] INFO  d.p.ree6.language.LanguageService - Language file uk is up to date! 
21:31:52.170 [main] INFO  de.presti.ree6.main.Main - Finished preparations of the Bot! 
21:31:52.170 [main] INFO  de.presti.ree6.main.Main - Starting Ree6! 
21:31:52.484 [main] INFO  org.reflections.Reflections - Reflections took 280 ms to scan 1 urls, producing 3 keys and 3 values 
21:31:52.557 [main] INFO  de.presti.ree6.sql.SQLConnector - Connecting to SQl-Service (SQL). 
21:31:52.567 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 
21:31:52.793 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@604c9f59 
21:31:52.798 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 
21:31:52.799 [main] INFO  de.presti.ree6.sql.SQLConnector - Service (SQL) has been started. Connection was successful. 
21:31:52.962 [main] INFO  o.f.c.i.license.VersionPrinter - Flyway Community Edition 9.22.3 by Redgate 
21:31:52.963 [main] INFO  o.f.c.i.license.VersionPrinter - See release notes here: https://rd.gt/416ObMi 
21:31:52.964 [main] INFO  o.f.c.i.license.VersionPrinter -  
21:31:53.040 [main] INFO  org.flywaydb.core.FlywayExecutor - Database: jdbc:sqlite:storage/Ree6.db (SQLite 3.43) 
21:31:53.152 [main] INFO  de.presti.ree6.sql.SQLConnector - Found 2 pending migrations. 
21:31:53.155 [main] INFO  de.presti.ree6.sql.SQLConnector - The pending migrations are: Initial, Add Giveaway 
21:31:53.155 [main] INFO  de.presti.ree6.sql.SQLConnector - Running Flyway Migrations. 
21:31:53.173 [main] INFO  o.f.c.internal.command.DbValidate - Successfully validated 2 migrations (execution time 00:00.007s) 
21:31:53.185 [main] INFO  o.f.core.internal.command.DbMigrate - Current version of schema "main": << Empty Schema >> 
21:31:53.286 [main] INFO  o.f.core.internal.command.DbMigrate - Migrating schema "main" to version "1 - Initial" 
21:31:53.318 [main] ERROR o.f.core.internal.command.DbMigrate - Migration of schema "main" to version "1 - Initial" failed! Changes successfully rolled back. 
21:31:53.320 [main] ERROR de.presti.ree6.main.Main - Shutting down, because of an critical error! 
org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Migration V1__Initial.sql failed
--------------------------------
SQL State  : null
Error Code : 1
Message    : [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
Location   : sql/migrations/V1__Initial.sql (/home/container/file:/home/container/Ree6.jar!/sql/migrations/V1__Initial.sql)
Line       : 405
Statement  : ALTER TABLE Money_Transaction
    ADD CONSTRAINT FK_MONEY_TRANSACTION_ON_RECEIVER FOREIGN KEY (receiver) REFERENCES Money_Holder (Id)

    at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:382)
    at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:272)
    at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55)
    at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:271)
    at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244)
    at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:139)
    at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate$1.call(TableLockingExecutionTemplate.java:36)
    at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55)
    at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate.execute(TableLockingExecutionTemplate.java:31)
    at org.flywaydb.core.internal.database.base.Connection.lock(Connection.java:102)
    at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:144)
    at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:139)
    at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:97)
    at org.flywaydb.core.Flyway.lambda$migrate$0(Flyway.java:188)
    at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:213)
    at org.flywaydb.core.Flyway.migrate(Flyway.java:140)
    at de.presti.ree6.sql.SQLConnector.runMigrations(SQLConnector.java:115)
    at de.presti.ree6.sql.SQLConnector.<init>(SQLConnector.java:59)
    at de.presti.ree6.sql.SQLSession.<init>(SQLSession.java:179)
    at de.presti.ree6.main.Main.main(Main.java:207)
Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Migration V1__Initial.sql failed
--------------------------------
SQL State  : null
Error Code : 1
Message    : [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
Location   : sql/migrations/V1__Initial.sql (/home/container/file:/home/container/Ree6.jar!/sql/migrations/V1__Initial.sql)
Line       : 405
Statement  : ALTER TABLE Money_Transaction
    ADD CONSTRAINT FK_MONEY_TRANSACTION_ON_RECEIVER FOREIGN KEY (receiver) REFERENCES Money_Holder (Id)

    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:267)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:222)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:68)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:57)
    at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27)
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:56)
    at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:374)
    ... 19 common frames omitted
Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "CONSTRAINT": syntax error)
    at org.sqlite.core.DB.newSQLException(DB.java:1179)
    at org.sqlite.core.DB.newSQLException(DB.java:1190)
    at org.sqlite.core.DB.throwex(DB.java:1150)
    at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
    at org.sqlite.core.NativeDB.prepare(NativeDB.java:132)
    at org.sqlite.core.DB.prepare(DB.java:264)
    at org.sqlite.jdbc3.JDBC3Statement.lambda$execute$0(JDBC3Statement.java:53)
    at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:459)
    at org.sqlite.jdbc3.JDBC3Statement.execute(JDBC3Statement.java:42)
    at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
    at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
    at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:201)
    at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:95)
    at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:210)
    ... 25 common frames omitted

Code of Conduct

DxsSucuk commented 1 year ago

Try using H2 might fix it.

DxsSucuk commented 7 months ago

No activity.