guzzle api create sequence issue: incorrect syntax near the keyword 'ORDER' - ja-guzzle/guzzle_docs GitHub Wiki

Background

This issue is faced when we have configured MsSQL Server 2017 as Guzzle repository.

error

Caused by: liquibase.exception.DatabaseException: Incorrect syntax near the keyword 'ORDER'. [Failed SQL: CREATE SEQUENCE [dbo].[users_sequence] START WITH 2 INCREMENT BY 1 MINVALUE 1 ORDER]
	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:309)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:113)
	at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1277)
	at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1259)
	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:582)

This error occurs when Guzzle API tries to create sequence with syntax CREATE SEQUENCE [dbo].[users_sequence] START WITH 2 INCREMENT BY 1 MINVALUE 1 ORDER. The ORDER keyword is not supported in MsSQL Server 2017.

Solution

We have to extract table_sequences.xml file from api-0.0.1-SNAPSHOT.jar and need to remove ORDER="true" property from that and add updated table_sequences.xml file back to api-0.0.1-SNAPSHOT.jar.

Extract table_sequence.xml file and update it

cd $GUZZLE_HOME/api
jar xf api-0.0.1-SNAPSHOT.jar BOOT-INF/classes/liquibase/changelog/00000000000005_table_sequences.xml
vi BOOT-INF/classes/liquibase/changelog/00000000000005_table_sequences.xml

Remove order="true" from every <createSequence ... ordered="true" ../> tag

Add updated table_sequences.xml in guzzle api jar

jar uf api-0.0.1-SNAPSHOT.jar BOOT-INF/classes/liquibase/changelog/00000000000005_table_sequences.xml 

Run guzzle API api-0.0.1-SNAPSHOT.jar

java -Dloader.path=${GUZZLE_HOME}/api/libs -jar api-0.0.1-SNAPSHOT.jar
⚠️ **GitHub.com Fallback** ⚠️