java liquibase.exception.DatabaseException:错误:“)”处或附近有语法错误

jslywgbw  于 2023-04-19  发布在  Java
关注(0)|答案(1)|浏览(261)

org.springframework.beans.factory.BeanCreationException:创建在类路径resource [org/springframework/ Boot /autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]中定义的名为“liquibase”的bean时出错:liquibase.exception.MigrationFailedException:迁移变更集liquibase/db失败。changelog-1.0.xml::1.0.0::bohdan.taran:原因:liquibase.exception.DatabaseException:错误:“)”处或附近有语法错误

<changeSet id="1.0.0" author="bohdan.taran">
        <createTable tableName="users">
            <column name="id" type="BIGINT" autoIncrement="true">
                <constraints primaryKey="true" nullable="false"/>
            </column>

            <column name="username" type="VARCHAR(100)">
                <constraints nullable="false" unique="true"/>
            </column>

            <column name="email" type="VARCHAR(255)">
                <constraints nullable="false" unique="true"/>
            </column>

            <column name="first_name" type="VARCHAR(100)">
                <constraints nullable="false"/>
            </column>

            <column name="last_name" type="VARCHAR(100)">
                <constraints nullable="false"/>
            </column>

            <column name="password" type="VARCHAR(255)">
                <constraints nullable="false"/>
            </column>

            <column name="created" type="TIMESTAMP" defaultValue="CURRENT_TIMESTAMP()">
                <constraints nullable="false"/>
            </column>

            <column name="updated" type="TIMESTAMP" defaultValue="CURRENT_TIMESTAMP()">
                <constraints nullable="false"/>
            </column>

            <column name="status" type="VARCHAR(25)" defaultValue="ACTIVE">
                <constraints nullable="false"/>
            </column>

        </createTable>
    </changeSet>

我在代码中找不到这个问题

9jyewag0

9jyewag01#

正确的语法是

CURRENT_TIMESTAMP

CURRENT_TIMESTAMP(<precision>)

例如,CURRENT_TIMESTAMP(5)表示秒字段中的5个小数位。

相关问题