アプリケーションをgrails 3.1.9に更新しました。データベース移行プラグインに問題があります。grails 3データベース移行
マイ生産application.ymlは、次のようになります。
buildscript {
dependencies {
classpath 'org.grails.plugins:database-migration:2.0.0.RC4'
}
}
dependencies {
compile 'org.liquibase:liquibase-core:3.4.1'
compile 'org.grails.plugins:database-migration:2.0.0.RC4'
}
これは、変更履歴の始まりです:
databaseChangeLog = {
changeSet(author: "michal (generated)", id: "1472650791344-1") {
createTable(tableName: "appointment") {
column(autoIncrement: "true", name: "id", type: "BIGINT") {
constraints(primaryKey: "true", primaryKeyName: "appointmentPK")
}
column(name: "version", type: "BIGINT")
column(name: "customer_id", type: "BIGINT")
column(name: "duration", type: "BLOB(255)")
column(name: "note", type: "CLOB")
column(defaultValueComputed: "0", name: "personal_available", type: "BOOLEAN")
column(defaultValueComputed: "0", name: "personal_booked", type: "BOOLEAN")
column(name: "provider_id", type: "BIGINT")
column(name: "start_time", type: "BLOB(255)")
column(name: "url", type: "VARCHAR(255)")
}
}
production:
dataSource:
driverClassName: org.postgresql.Driver
dialect: org.hibernate.dialect.PostgreSQLDialect
dbCreate: none
url: jdbc:postgresql://localhost:5432/something
username: postgres
password: postgres
properties:
私のbuild.gradleは、このようになります私は生産モードで私のアプリを実行すると、私はこのエラーが発生します。
SEVERE 8/31/16 3:41 PM: liquibase: changelog.groovy: changelog.groovy::1472650791344-1::michal (generated): Change Set changelog.groovy::1472650791344-1::michal (generated) failed. Error: ERROR: relation "appointment" already exists [Failed SQL: CREATE TABLE public.appointment (id BIGSERIAL NOT NULL, version BIGINT, customer_id BIGINT, duration BYTEA, note TEXT, personal_available BOOLEAN DEFAULT 0, personal_booked BOOLEAN DEFAULT 0, provider_id BIGINT, start_time BYTEA, url VARCHAR(255), CONSTRAINT "appointmentPK" PRIMARY KEY (id))]
liquibase.exception.DatabaseException: ERROR: relation "appointment" already exists [Failed SQL: CREATE TABLE public.appointment (id BIGSERIAL NOT NULL, version BIGINT, customer_id BIGINT, duration BYTEA, note TEXT, personal_available BOOLEAN DEFAULT 0, personal_booked BOOLEAN DEFAULT 0, provider_id BIGINT, start_time BYTEA, url VARCHAR(255), CONSTRAINT "appointmentPK" PRIMARY KEY (id))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
...
Caused by: org.postgresql.util.PSQLException: ERROR: relation "appointment" already exists
それは動作しませんなぜ私は、任意のアイデアを高く評価することでしょう。
ありがとうグレゴール・ペキン。検証するためにdbcreateを設定すると、このエラーを修正するのに役立ちました。
明示的に 'dbCreate'を' none'ではなく 'validate'に設定すると助けになりますか? –
@Gregor Petrinこんにちは助けてくれたようです。私の編集を参照してください。 –