Spring 测试 H2 Flyway - sql 语句中的错误
Spring Test H2 Flyway - error in sql statement
我有以下 sql 迁移,它不适用于 h2。如果我删除以下 SQL - 一切正常。我该如何解决?
SQL State : 42001
Error Code : 42001
Message : Syntax error in SQL statement "CREATE TABLE USER_AUTHORITY
(
USER_AUTHORITY_ID BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
USER_ID BIGINT REFERENCES USR (USER_ID) NOT NULL[*],
AUTHORITY_ID BIGINT REFERENCES AUTHORITY (AUTHORITY_ID) NOT NULL,
OPERATION VARCHAR(2) NOT NULL,
CREATION_DATETIME TIMESTAMP WITH TIME ZONE NOT NULL,
MODIFYING_DATETIME TIMESTAMP WITH TIME ZONE NOT NULL
)"; expected "DEFERRABLE";
Location : db/migration/V1__Schema.sql (/home/v/IdeaProjects/stocky/user-service/build/resources/main/db/migration/V1__Schema.sql)
Line : 29
Statement : create table user_authority
这是解析器的错误。我填写了一个关于它的新问题:
https://github.com/h2database/h2database/issues/3413
您可以在 REFERENCES
之前指定 NOT NULL
作为解决方法。
USER_ID BIGINT NOT NULL REFERENCES USR (USER_ID),
AUTHORITY_ID BIGINT NOT NULL REFERENCES AUTHORITY (AUTHORITY_ID),
我有以下 sql 迁移,它不适用于 h2。如果我删除以下 SQL - 一切正常。我该如何解决?
SQL State : 42001
Error Code : 42001
Message : Syntax error in SQL statement "CREATE TABLE USER_AUTHORITY
(
USER_AUTHORITY_ID BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
USER_ID BIGINT REFERENCES USR (USER_ID) NOT NULL[*],
AUTHORITY_ID BIGINT REFERENCES AUTHORITY (AUTHORITY_ID) NOT NULL,
OPERATION VARCHAR(2) NOT NULL,
CREATION_DATETIME TIMESTAMP WITH TIME ZONE NOT NULL,
MODIFYING_DATETIME TIMESTAMP WITH TIME ZONE NOT NULL
)"; expected "DEFERRABLE";
Location : db/migration/V1__Schema.sql (/home/v/IdeaProjects/stocky/user-service/build/resources/main/db/migration/V1__Schema.sql)
Line : 29
Statement : create table user_authority
这是解析器的错误。我填写了一个关于它的新问题: https://github.com/h2database/h2database/issues/3413
您可以在 REFERENCES
之前指定 NOT NULL
作为解决方法。
USER_ID BIGINT NOT NULL REFERENCES USR (USER_ID),
AUTHORITY_ID BIGINT NOT NULL REFERENCES AUTHORITY (AUTHORITY_ID),