简体   繁体   English

Strapi 不会删除内容类型字段

[英]Strapi doesn't delete content-type field

When making api requests, for example a POST Request to an endpoint named "new-restaurant" , the old fields (that was already removed) still show up in these new entries.发出 api 请求时,例如对名为“new-restaurant”的端点的POST请求,旧字段(已删除)仍显示在这些新条目中。

Example: POST request to myrestaurants/new-restaurant示例:向 myrestaurants/new-restaurant 发送 POST 请求

{
id: "restaurant id",
name: "new restaurant name",
zip code: "restaurant zip code",
}

API response: API 回复:

{
id: "restaurant id",
name: "new restaurant name",
zip code: "restaurant zip code",
}

and when I delete, from the admin pannel, the entry "zip code" from this content-type, and make another request to the same endpoint but without the field that was deleted from this content-type, for example:当我从管理面板中删除此内容类型中的条目“邮政编码”,并向同一端点发出另一个请求但没有从此内容类型中删除的字段时,例如:

POST request to myrestaurants/new-restaurant向 myrestaurants/new-restaurant 发送请求

{
id: "restaurant id",
name: "new restaurant name",
}

API response is: API 响应是:

{
id: "restaurant id",
name: "new restaurant name",
zip code: null,
}

I tried looking after all the files in my strapi projects, the models, schemas and all of it, and didn't find this deleted field mentioned anywhere, but it still comes out with my new POST requests, and I don't know why?!我尝试查看我的 strapi 项目中的所有文件、模型、模式和所有这些文件,但没有在任何地方找到这个已删除的字段,但它仍然出现在我的新 POST 请求中,我不知道为什么?!

It's because you still have the column zip code in your data base.这是因为您的数据库中仍然有列zip 代码 It's not deleted when you delete the entry in the admin panel.当您删除管理面板中的条目时,它不会被删除。 I don't know why!我不知道为什么!

You can go in your data base and drop the column by yourself.您可以在您的数据库中使用 go 并自行删除该列。

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

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