我一直在尝试为我的Redshift数据库使用这个(https://github.com/liquibase/liquibase-redshift/releases(插件,但无法让它工作。我主要面临两个问题。
- 无效操作:在"TAG"处或附近出现语法错误。我通过手动创建数据库更改日志表来解决此问题。 将
- 记录插入数据库更改日志表时出错,原因是 LB 在插入查询中使用了 now(( 函数。
我看到这两个问题都被标记为已修复(https://github.com/liquibase/liquibase-redshift/issues/9(,但是,我仍然面临这些问题。由于项目的性质,我无法在 jar 文件中手动进行任何更改。因此,如果有人能对此提供任何见解,将不胜感激。我也在我的更改日志.xml文件中使用了dbms="redshift"
。
提前感谢您的任何帮助。
更新日志.xml
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="devsh0" id="9.9.9.9" logicalFilePath="LOGICALPATH" runOnChange ="true" >
<sqlFile
path="src/main/dbo/app-code.SQL"
dbms="RedshiftDatabase"
stripComments="true"
/>
</changeSet>
</databaseChangeLog>
我的变更集(app-code.sql)
出现在src/main/dbo/
create table Test_Table
(
col1 VARCHAR(3) not null,
col2 VARCHAR(20) not null,
col3 VARCHAR(50) not null
)
聚甲醛.XML
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>local_redshift</groupId>
<artifactId>local_redshift</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>redshift</id>
<url>https://s3.amazonaws.com/redshift-maven-repository/release</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>com.amazon.redshift</groupId>
<artifactId>redshift-jdbc42</artifactId>
<version>1.2.43.1067</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-redshift</artifactId>
<version>3.10.0</version>
</dependency>
<!--dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.8</version>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<propertyFile>src/main/liquibase.redshift.properties</propertyFile>
<changeLogFile>src/main/changelog/changelog-1.0.0.0.1.xml</changeLogFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
</plugin>
</plugins>
</build>
</project>```
在您的更新日志中.xml它是dbms="RedshiftDatabase"
- 它应该是dbms="redshift"
:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="devsh0" id="9.9.9.9" logicalFilePath="LOGICALPATH" runOnChange ="true" >
<sqlFile
path="src/main/dbo/app-code.SQL"
dbms="redshift"
stripComments="true"
/>
</changeSet>
</databaseChangeLog>
由于错误地指定了Redshift数据库。