我正在从Oracle迁移到PostgreSQL。我们一直在迁移到Liquibase,但不是从一开始。现在我正在添加和调整迁移以完全部署数据库并将数据传输到那里。
现在我遇到了这样一个问题,即无法创建具有与另一个表关联的约束的列的表。由于在约束中指定了显式方案,因此不会选择此限制。
如何指定对于未指定方案的表的约束使用默认方案?
使用Maven插件liquibase-maven-plugin 3.5.3
以下是属性:
告诉我如何优雅地解决这个问题。谢谢。
现在我遇到了这样一个问题,即无法创建具有与另一个表关联的约束的列的表。由于在约束中指定了显式方案,因此不会选择此限制。
如何指定对于未指定方案的表的约束使用默认方案?
使用Maven插件liquibase-maven-plugin 3.5.3
以下是属性:
Url: jdbc: postgresql: //192.168.1.1: 5432 / postgres
DefaultSchemaName: ist
ReferencedTableSchemaName: ist
Username: test
Password: 123
Verbose: true
DropFirst: false
这里是迁移文档
- createTable:
TableName: opr_possibilities
Remarks: Operator capability map
Columns:
- column:
Name: id
Type: number (11)
Remarks: ID
Constraints:
Nullable: false
PrimaryKey: true
- column:
Name: operator_id
Type: number (11)
Remarks: Operator ID
Constraints:
Nullable: false
ForeignKeyName: fk_possibility_operator
References: ds_obj_opr (id)
# ReferencedTableName: ds_obj_opr
# ReferencedColumnNames: id
迁移会生成这样的请求:
CREATE TABLE ist.opr_possibilities (
id numeric(11) NOT NULL,
operator_id numeric(11) NOT NULL,
begin_date date DEFAULT NOW() NOT NULL,
end_date date DEFAULT NOW() NOT NULL,
duty BOOLEAN DEFAULT FALSE NOT NULL,
status numeric(4) DEFAULT 0 NOT NULL,
type numeric(4) DEFAULT 0 NOT NULL,
remarks VARCHAR(255),
CONSTRAINT PK_OPR_POSSIBILITIES PRIMARY KEY (id),
CONSTRAINT fk_possibility_operator FOREIGN KEY (operator_id) REFERENCES ds_obj_opr(id)
)
告诉我如何优雅地解决这个问题。谢谢。