Questions tagged [foreign-key-constraint]

Foreign keys are a data integrity feature of relational (and SQL) databases. A foreign key is a set of attributes in a relational table that is subject to a referential integrity constraint. The referential integrity constraint mandates that the values of the foreign key attributes in one table, A, must match with corresponding values in some specified table B (which may sometimes be the same table as A).

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

Error Unique constraint violation found Checkout as Guest

After migrating the e-commerce server, at the time of payment the payment is made correctly, but as a response I get "Unique constraint violation found", at the time of migration I got SQL ...
Donaldo Manzano's user avatar
0 votes
1 answer
90 views

db_schema can't set foreign key - Table [prefix]_sales_order do not have column with name "name"

I must add column1 to sales_order_grid and create foreign key to table sales_grid.column1 When i try use bin/magento setup:upgrade i get next message Table [myPrefix]_sales_order do not have column ...
esca7a's user avatar
  • 11
3 votes
1 answer
837 views

Getting Integrity constraint violation: 1062 Duplicate entry after updating extension

After updating one of my extensions (which was required because I updated to Magento 2.4.4), I am getting this error when I run the upgrade command: SQLSTATE[23000]: Integrity constraint violation: ...
user4095519's user avatar
0 votes
1 answer
1k views

Magento 2 - create a table with foreign key constraint

I try to add this database table. It has a foreign key constraint to the customer_entity table. I need to configure it so if the customer is getting deleted that record is also getting deleted. This ...
Black's user avatar
  • 3,150
0 votes
2 answers
298 views

why setup upgrade command revert back already dropped foreign key in magento 2.4.2

I have written one custom module with a simple UpgradeSchema file to drop core foreign key (table product_alert_stock, foreign key name - PRODUCT_ALERT_STOCK_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID ) ...
Param Kumar's user avatar
0 votes
2 answers
152 views

Magento 2 - how to re-install missing foreign-key constraints?

I am using a third party extension. I noticed that a constraint is missing by comparing with a fresh installation. This causes a bug when deleting an item of the extension. Is there a command which is ...
Black's user avatar
  • 3,150
1 vote
1 answer
439 views

Magento 2 - Foreign Key Constraint does not delete record

I am using the extension Amasty Product Attachments. If I add an attachment to a product and then delete that attachment from Amasty -> Product Attachments -> Attachments Management, then I can'...
Black's user avatar
  • 3,150
0 votes
0 answers
89 views

Search for a deleted table's reference id in all tables, rows and columns of a DB

I had copied the table structure of table 'url_rewrite' and created a new table named 'url_rewrite_new' with empty data in my Magento 2 store DB, also renamed the 'url_rewrite' table. Then I ran ...
IntraPersonalLearner's user avatar
2 votes
0 answers
224 views

After Upgrate Magento 2 from version 2.2.5 to 2.3.4 Integrity constraint violation: 1452 Cannot add or update a child row

I am trying to upgrade Magento 2 version from 2.2.5 to 2.3.4 using CLI. Version up-gradation is done. After version upgrade when I run bin/magento setup:upgrade it will give an error as follow: ...
Divyarajsinh Dodiya's user avatar
0 votes
1 answer
199 views

Foreign Key Constraint

the following error as seen in the screenshot came up during the data migration from M1 to M2 using data migration tool. Please share your views as to how I go about eliminating this error with a ...
CodeForGood's user avatar
0 votes
1 answer
114 views

How to put a 'select' text inside a dropdown in the admin section? Magento2

I have a form in the admin section that has a phone numbers dropdown. This dropdown is pulling its values from a phone number table. I added a 'Select--' to the first option of the dropdown so the ...
R.P.'s user avatar
  • 99
1 vote
0 answers
54 views

Unable to create duplicate product in Magento 1.9

I have tried to create a product using the duplicate product in Magento 1.9.3.1. It gives an error as follow
Divyarajsinh Dodiya's user avatar
1 vote
1 answer
928 views

Declarative schema: Incorrect Foreign Key Diff

We created a new table using M2's declarative scheme like this: <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/...
Tyler V.'s user avatar
  • 2,987
0 votes
1 answer
1k views

Magento1: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails

getting the error while uploading the media files to the products, I have tried repairing the tables and also tried increasing the INT value in table structure still giving the following error: ...
Xabby's user avatar
  • 529
5 votes
1 answer
1k views

Magento 2.3 Error on Delete All Test Data from Database

We are in the process of migrating to Magento 2.3, but need to remove all test data from the database and reset all increment ID's back to 1. Having some troubles removing all order information: SET ...
AJK's user avatar
  • 741