0

我正在使用 mysql 8.0.x 并尝试使用 liquibase 版本 3.6.2 来应用更改日志。

当我尝试通过命令行更新变更日志时,它适用于 yaml 格式,但 sql 格式不适用于变更集。

是整个设置。command-to-run.batfile 是我要触发的确切命令。

我认为问题与相同,但该解决方案也不起作用。他们的问题是文件的格式不应该是 UTF-8 BOM 格式,虽然该问题已解决,但我尝试更改格式但我仍然遇到问题。

我正在使用与 liquibase 给出的示例相同的 sql 文件。我得到的错误是

Unexpected error running Liquibase: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
liquibase.exception.MigrationFailedException: Migration failed for change set changelog-master.xml::third::akshay:
     Reason: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:78)
        at liquibase.Liquibase.update(Liquibase.java:202)
        at liquibase.Liquibase.update(Liquibase.java:179)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1205)
        at liquibase.integration.commandline.Main.run(Main.java:191)
        at liquibase.integration.commandline.Main.main(Main.java:129)
Caused by: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1 [Failed SQL: --liquibase formatted sql

--changeset bob:1
create table item (
  id int not null primary key,
  name varchar(255) not null,
  description varchar(255)
)]
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:356)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
        at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1229)
        at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1211)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:600)
        ... 7 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql

--changeset bob:1
create table item (
  id int not nu' at line 1
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
        at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
        ... 12 common frames omitted


For more information, please use the --logLevel flag
4

0 回答 0