【发布时间】:2021-10-16 15:27:43
【问题描述】:
我想更改表中的一些名称。我正在使用 Flyway,所以我使用迁移。 我想更改表中的名称,但脚本看不到表。数据库已docker化。
我想改变这个:
create table if not exists document_entity
(
document_id varchar
constraint document_entity_document_id
not null primary key,
document_file varchar not null
);
进入这个:
alter table document_entity
rename to documents;
alter table document_entity
rename column document_id to id;
alter table document_entity
rename column document_file to file;
我还必须从第一个表更改关系,但不知道如何写。
【问题讨论】:
-
嗯,在您已经将
document_id重命名为id之后,您正在尝试重命名它。当然document_id在那个时候已经找不到了,它现在被称为id。 -
我在写帖子时弄错了,编辑了它
标签: postgresql migration flyway