Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Liquibase SQL Server脚本在H2 db测试中失败_Java_Sql Server_H2_Liquibase - Fatal编程技术网

Java Liquibase SQL Server脚本在H2 db测试中失败

Java Liquibase SQL Server脚本在H2 db测试中失败,java,sql-server,h2,liquibase,Java,Sql Server,H2,Liquibase,我得到了SQL Server数据库的liquibase变更集,如下所示 <changeSet author="diff-generated" id="1579082307417-3"> <sql> alter table UsersRoles add Id int identity </sql> </changeSet> <changeSet au

我得到了SQL Server数据库的liquibase变更集,如下所示

<changeSet author="diff-generated" id="1579082307417-3">
        <sql>
            alter table UsersRoles
            add Id int identity
        </sql>
    </changeSet>
    <changeSet author="diff-generated" id="1579082307417-4">
        <sql>
            alter table UsersRoles
            add constraint UsersRoles_pk
            primary key nonclustered(Id)
        </sql>
    </changeSet>
我试图将驱动程序更改为SQL Server驱动程序,但这不起作用。
有什么问题吗?

H2不支持SQL Server中的
非聚集
子句,您需要为H2删除它

altertableusersroles
添加约束UsersRoles\u pk
主键(Id)

谢谢,不幸的是,我收到了相同的错误,只是没有非聚集错误消息。我现在做的解决方法是使用变更集的dbms选项拆分h2和mssql的脚本。对于H2,我使用xml符号编写,而不是纯sql
changeLogFile=classpath:/liquibase/database-changelog.xml
url=jdbc:h2:mem:testDb;MODE=MSSQLServer
username=SA
password=
driver=org.h2.Driver