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

fix clone entity, #20509 #20531

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

morohon
Copy link

@morohon morohon commented Jun 16, 2024

What does it do?

Added information about the schema when executing a request for clear inverse order column

Why is it needed?

Merging this PR will solve the entity duplication error when using a potgresql database when using a non-default schema.

How to test it?

For testing, you need to use a postgresql database (declared in docker-compose.dev.yml is sufficient). You need to run the getstarted application on NOT THE DEFAULT SCHEMA postgresql (If the schema is default for postgresql, then the query without specifying the schema will succeed and the problem will not appear). After launch, you need to create 2 collection type entities:

  1. Products (singular api id = product, plural api id = products) with field name (short text).
  2. Products by region (singular api id = product-by-region, plural api id = products-by-region) with field name (short text) and relation manyToOne to products (in products by region there is one link to products and in products there are many links to products by region)

Next, you need to create several products (product1 and product2). Then go to products by region and create a product: product from New York with a link to product1. After saving this product, you must return to the page for storing products by region and click the “Duplicate” button.

Also, when you enable logging of database queries, you can see a corrected database query of the following type (the query includes a schema):

update "test"."products_by_region_product_links" as "t1" set "product_by_region_order" = (select max(product_by_region_order) + 1 from "test"."products_by_region_product_links" as "t2" where t2.product_id = t1.product_id) where "t1"."product_by_region_id" = ?

Related issue(s)/PR(s)

Fix #20509

Copy link

vercel bot commented Jun 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2024 2:32pm

@strapi-cla
Copy link

strapi-cla commented Jun 16, 2024

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relation <> does not exists
2 participants