Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Types ending with "s" can't be saved #5190

Closed
eiskalteschatten opened this issue Feb 5, 2020 · 2 comments · Fixed by #5607
Closed

Content Types ending with "s" can't be saved #5190

eiskalteschatten opened this issue Feb 5, 2020 · 2 comments · Fixed by #5607
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-manager Source is core/content-manager package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@eiskalteschatten
Copy link

eiskalteschatten commented Feb 5, 2020

Describe the bug
When creating a content type that ends in the letter "s", Strapi automatically creates the table in the database using "es" for the plural. The problem is that if you have a component within that content type, the column with the ID added to the component table is correct without the "es", but Strapi looks for it just without the "s".

For example:
Content Type: "about_us"
Table name: "about_uses" (sounds funny, but whatever)
A component is added to the "about_us" content type. In the component table, the "about_us_id" column is added, but Strapi looks for the column "about_use_id".

Steps to reproduce the behavior

  1. Create type: "about_us"
  2. Create a component and add it to the content type.
  3. Start Strapi and create an item of content type "about_us".
  4. Try saving. An error is returned.

Expected behavior
The item should be saved and Strapi should look for the column without the "e" that it added to the name.

System

  • Node.js version: 10.18.1
  • Strapi version: 3.0.0-beta.18.6
  • Database: Postgres
  • Operating system: Linux
@lauriejim lauriejim added severity: medium If it breaks the basic use of the product but can be worked around status: confirmed Confirmed by a Strapi Team member or multiple community members issue: bug Issue reporting a bug labels Feb 6, 2020
@lauriejim
Copy link
Contributor

Hello @eiskalteschatten !
You are right! Thank you for reporting this issue.

@eiskalteschatten
Copy link
Author

No problem! I'm glad you were able to understand the description because I had difficulties finding a good way to describe it.

@lauriejim lauriejim added the source: core:content-manager Source is core/content-manager package label Feb 11, 2020
@lauriejim lauriejim changed the title Content types ending with "s" can't be saved Content Types ending with "s" can't be saved Feb 11, 2020
alexandrebodin added a commit that referenced this issue Mar 26, 2020
…nNameInQuery

Fix bad singular form of column name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: core:content-manager Source is core/content-manager package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants