简体   繁体   English

更改内容类型后无法重新启动 Strapi(使用 SQLite)

[英]Cannot restart Strapi after making changes to Content Types (using SQLite)

I have followed the quickstart setup for Strapi, which as I understand sets up an SQLite Database.我遵循了 Strapi 的快速入门设置,据我所知,它设置了一个 SQLite 数据库。 I created one collection type (painting) which worked without problems, but whenever I try to add a new one or make changes to the existing one the server does not restart and I receive the following error output in my console:我创建了一种可以正常工作的集合类型(绘画),但是每当我尝试添加新的或对现有的进行更改时,服务器不会重新启动,并且我在控制台中收到以下错误输出:

[2022-05-23 16:53:16.323] error: CREATE TABLE _knex_temp_alter889 ( id integer not null primary key autoincrement PRIMARY KEY AUTOINCREMENT NOT NULL, title varchar(255) NULL, artist varchar(255) NULL, created_at datetime NULL, updated_at datetime NULL, published_at datetime NULL, created_by_id integer NULL, updated_by_id integer NULL, CONSTRAINT paintings_created_by_id_fk FOREIGN KEY ( created_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_created_by_id_fk FOREIGN KEY ( created_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL) - table "_knex_temp_alter889" has more than one primary key SqliteError: CREATE TABLE _knex_temp_alter889 ( id integer not null primary key autoincrement PRIMARY KEY AUTOINCREMENT NOT NULL, title [2022-05-23 16:53:16.323] 错误:CREATE TABLE _knex_temp_alter889id integer not null 主键自动增量 PRIMARY KEY AUTOINCREMENT NOT NULL, title varchar(255) NULL, artist varchar(255) NULL, created_at datetime NULL, updated_at datetime NULL, published_at datetime NULL, created_by_id integer NULL, updated_by_id integer NULL, CONSTRAINT paintings_created_by_id_fk FOREIGN KEY ( admin_users created_by_id id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id CONSTRAINT) paintings_created_by_id_fk FOREIGN KEY ( created_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL) - 表“_knex_temp_alter889”有多个主键 _knex_temp: _knex_temp_alter889 id integer not null 主键自动增量 PRIMARY KEY AUTOINCREMENT NOT NULL, title title varchar(255) NULL, artist varchar(255) NULL, created_at datetime NULL, updated_at datetime NULL, published_at datetime NULL, created_by_id integer NULL, updated_by_id integer NULL, CONSTRAINT paintings_created_by_id_fk FOREIGN KEY ( created_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_created_by_id_fk FOREIGN KEY ( created_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL, CONSTRAINT paintings_updated_by_id_fk FOREIGN KEY ( updated_by_id ) REFERENCES admin_users ( id ) ON DELETE SET NULL) - table "_knex_temp_alter889" has more than one primary key title varchar(255) NULL, artist varchar(255) NULL, created_at datetime NULL, updated_at datetime NULL, published_at datetime NULL, created_by_id整数 NULL, updated_by_id整数 NULL,约束paintings_created_by_id_fk外键( created_by_id )参考admin_usersid )ON DELETE SET NULL ,约束paintings_updated_by_id_fk id外键( updated_by_id )引用admin_usersidadmin_users updated_by_id set null,限制paintings_created_by_id_fkcreated_by_id paintings_updated_by_id_fk admin_usersid ) NULL) - 表“_knex_temp_alter889”有多个主键

Deleting the changes I made in my content-types files is currently the only way I have of getting the server to run again.删除我在内容类型文件中所做的更改是目前让服务器再次运行的唯一方法。 How do I fix this?我该如何解决?

So, I ended up creating a new project.所以,我最终创建了一个新项目。 Problem seems to have been that I added a field named 'ID', which I assume messed everything up because it conflicted with the automatically assigned ID-System.问题似乎是我添加了一个名为“ID”的字段,我认为它搞砸了一切,因为它与自动分配的 ID 系统冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM