我正在尝试在Liquibase中为我的JHipster应用程序构建View PostgreSQL表。因此,我尝试过createView和sqlFile方法。我的查询有date_trunc()函数如下:
CREATE OR REPLACE VIEW periodical_statistics AS
SELECT tran.id, date_trunc('day', tran.pub_date) as, ...
FROM transaction tran
...(LEFT JOINS - not relative)...
WHERE ...(condtions - not relative)...
当我在maven(./mvnw
)中将我的JHispster应用程序作为开发模式运行时。它工作得很好。
但是当我在maven(./mvnw -Pprod package
)中将其作为Prod Mode运行时。它给出了以下错误。
20180817101122-1::liquibase-docs failed. Error: Function "DATE_TRUNC" not found;
SQL statement: CREATE OR REPLACE VIEW periodical_statistics AS ....
有什么办法可以解决这个错误问题吗?
将dbms='postgresql'
添加到变更集后。 Liquibase识别'date_trunc'函数。它如下:
<changeSet author="sanatbek" id="20180904094713" dbms="postgresql">
<createView replaceIfExists="true"
schemaName="public"
viewName="periodical_statistics">
SELECT
tran.id
date_trunc('day', tran.pub_date) as truncated_date,
....
...(LEFT JOINS - not relative)...
WHERE ...(condtions - not relative)...
</createView>
</changeSet>