Liquibase无法导入hsql的更改集

时间:2018-08-22 17:02:36

标签: sql jhipster hsqldb liquibase

有默认的jhipster生成的spring boot应用程序。在生成数据库时,将数据库设置为h2并生成了liquibase变更集。然后将数据库更改为hsql。

pom:

<plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase.version}</version>
                <configuration>
                    <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
                    <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                    <driver>org.hsqldb.jdbc.JDBCDriver</driver>
                    <url>jdbc:hsqldb:file:./target/hsqldb/db/server</url>
                    <defaultSchemaName></defaultSchemaName>
                    <username>server</username>
                    <password></password>
                    <referenceUrl>hibernate:spring:com.mycompany.myapp.domain?dialect=org.hibernate.dialect.H2Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
                    <verbose>true</verbose>
                    <logging>debug</logging>
                </configuration>

....
<plugin>

application-dev.yml

spring:
    profiles:
        active: dev
        include: swagger
    devtools:
        restart:
            enabled: true
        livereload:
            enabled: false # we use Webpack dev server + BrowserSync for livereload
    jackson:
        serialization.indent_output: true
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        driverClassName: org.hsqldb.jdbc.JDBCDriver
        url: jdbc:hsqldb:file:./target/hsqldb/db/server
        username: server
        password:
    jpa:
        database: hsql
        show-sql: true
        properties:
            hibernate.id.new_generator_mappings: true
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.BeanClassLoaderAwareJCacheRegionFactory
    liquibase:
        contexts: dev

控制台:

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster:
     Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "CREATE TABLE PUBLIC.JHI_USER (ID BIGINT AUTO_INCREMENT NOT NULL, LOGIN VARCHAR(50) NOT NULL, PASSWORD_HASH VARCHAR(60), FIRST_NAME VARCHAR(50), LAST_NAME VARCHAR(50), EMAIL VARCHAR(254), IMAGE_URL VARCHAR(256), ACTIVATED BOOLEAN NOT NULL, LANG_KEY VARCHAR(6), ACTIVATION_KEY VARCHAR(20), RESET_KEY VARCHAR(20), CREATED_BY VARCHAR(50) NOT NULL, CREATED_DATE TIMESTAMP DEFAULT $ NOW[*]  NOT NULL, RESET_DATE TIMESTAMP, LAST_MODIFIED_BY VARCHAR(50), LAST_MODIFIED_DATE TIMESTAMP, CONSTRAINT PK_JHI_USER PRIMARY KEY (ID), CONSTRAINT UX_USER_EMAIL UNIQUE (EMAIL), CONSTRAINT UX_USER_LOGIN UNIQUE (LOGIN)) "; expected "[, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, ILIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ON, NOT, NULL, AUTO_INCREMENT, BIGSERIAL, SERIAL, IDENTITY, NULL_TO_DEFAULT, SEQUENCE, SELECTIVITY, COMMENT, CONSTRAINT, PRIMARY, UNIQUE, NOT, NULL, CHECK, REFERENCES, ,, )"; SQL statement:
CREATE TABLE PUBLIC.jhi_user (id BIGINT AUTO_INCREMENT NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(254), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(6), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date TIMESTAMP DEFAULT $ now  NOT NULL, reset_date TIMESTAMP, last_modified_by VARCHAR(50), last_modified_date TIMESTAMP, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_email UNIQUE (email), CONSTRAINT ux_user_login UNIQUE (login)) [42001-197] [Failed SQL: CREATE TABLE PUBLIC.jhi_user (id BIGINT AUTO_INCREMENT NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(254), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(6), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date TIMESTAMP DEFAULT ${now} NOT NULL, reset_date TIMESTAMP, last_modified_by VARCHAR(50), last_modified_date TIMESTAMP, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_email UNIQUE (email), CONSTRAINT ux_user_login UNIQUE (login))]

0 个答案:

没有答案