我进行了一些初始迁移,这会创建一些相关的表。
当我发现scheme中的表被命名为incorrectly时,我决定将它们重命名为this
之后,我尝试升级数据库(conduit db upgrade
),但出现问题:
C:\flutter_projects\dart_backend>dart run conduit:conduit db upgrade
Building package executable...
Built conduit:conduit.
— Conduit CLI Version: 4.1.6
— Conduit project version: 4.1.6
— Updating to version 2 from version 1...
Replaying versions: 1...
PostgreSQL connecting, postgres@localhost:5432/flutter-project.
Applying migration version 2...
CREATE TABLE authors (id BIGSERIAL PRIMARY KEY)
CREATE TABLE posts (id BIGSERIAL PRIMARY KEY,content TEXT NOT NULL)
CREATE TABLE users (id BIGSERIAL PRIMARY KEY,userName TEXT NOT NULL UNIQUE,email TEXT NOT NULL UNIQUE,password TEXT NOT NULL,accessToken TEXT NULL,refreshToken TEXT NULL)
CREATE INDEX users_userName_idx ON users (userName)
CREATE INDEX users_email_idx ON users (email)
ALTER TABLE posts ADD COLUMN author_id BIGINT NOT NULL
CREATE INDEX posts_author_id_idx ON posts (author_id)
ALTER TABLE ONLY posts ADD FOREIGN KEY (author_id) REFERENCES authors (id) ON DELETE CASCADE
DROP TABLE _Author
*** There was an issue. Reason: удалить объект таблица _author нельзÑ, так как от него завиÑÑÑ‚ другие объекты. Table: null Column: null
我怎样才能解决这个问题?是否可以删除表级联?或者我可以强制导管重命名,而不是删除创建?
1条答案
按热度按时间0md85ypi1#
解决方案是编辑迁移并设置正确的表删除顺序以排除缺失的关系