【发布时间】:2021-06-05 10:48:22
【问题描述】:
每个人。 我在兼容 h2 in-memory 和 postgresql 时遇到了一些麻烦。我试图在堆栈溢出和谷歌中找到我的解决方案,但每个人都使用 Gradle 或其他配置文件。就我而言,我使用了 application.properties 文件,但在 SQL 语句中出现语法错误。
我的错误: enter image description here
我的资源结构: enter image description here
比如我的部分sql脚本:
CREATE TABLE candle_1day
(
id serial primary key NOT NULL,
created_at timestamp(6) without time zone, --> not compability type
open_price numeric(35, 15) CHECK ( open_price >= 0 ),
close_price numeric(35, 15) CHECK ( close_price >= 0 ),
high_price numeric(35, 15) CHECK ( high_price >= 0 ),
low_price numeric(35, 15) CHECK ( low_price >= 0 ),
volume numeric(35, 15) CHECK ( volume >= 0 ),
currency_id integer NOT NULL,
CONSTRAINT unq_candle_1day_currency_id_created_at_idx UNIQUE (currency_id, created_at),
CONSTRAINT fk_candle_1day_currency_id_to_currency_info_id
FOREIGN KEY (currency_id) REFERENCES currency_info (id)
);
我的 application.properties 文件:
spring.datasource.driver-class-name=org.h2.Driver
spring.flyway.user=sa
spring.flyway.password=sa
spring.flyway.schemas=testdb
spring.flyway.url=jdbc:h2:mem:testdb;MODE=PostgreSQL;database_to_upper=false
spring.flyway.locations=filesystem:migration
【问题讨论】:
标签: spring postgresql h2 flyway