# Issue with sales channel domain

**URL:** <https://forum.shopware.com/t/issue-with-sales-channel-domain/101817>\
**Category:** Programming (EN)\
**Tags:** administration, programming\
**Created:** [7. November 2023 um 09:30 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817 "2023-11-07T09:30:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yedhukrishna.girish](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yedhukrishna.girish](https://forum.shopware.com/u/yedhukrishna.girish)\
**Post date:** [7. November 2023 um 09:30 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/1 "2023-11-07T09:30:39Z")

</div>

Hi,

we want to delete a sales channel, but we are getting this error.

#1451 - Unable to delete or update parent line: a foreign key condition fails (‚test2‘.‚customer‘, CONSTRAINT ‚fk.customer.bound\_sales\_channel\_id‘ FOREIGN KEY(‚bound\_sales\_channel\_id‘) REFERENCES ‚sales\_channel‘ (‚id‘) ON UPDATE CASCADE)

How can we resolve this issue?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [7. November 2023 um 10:07 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/2 "2023-11-07T10:07:00Z")

</div>

You have customers that are assigned to that sales channel. You have either manually assign them to a other sales channel or you can do it via the database. Then you will be able to delete the sales channel (or a other FOREIGEN KEY error will appear and you have to do the same again).

---

<div class="post-metadata">

**Author:** ![yedhukrishna.girish](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yedhukrishna.girish](https://forum.shopware.com/u/yedhukrishna.girish)\
**Post date:** [13. November 2023 um 08:15 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/3 "2023-11-13T08:15:48Z")

</div>

yes… I did it via database . But once i started to update to 6.5, im getting another sales channel id foreign key exception .

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`system_config`, CONSTRAINT `fk.system_config.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)"

But i checked the DB before and after update , system\_config table is not present. How can i solve this?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [13. November 2023 um 11:21 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/4 "2023-11-13T11:21:54Z")

</div>

> [@yedhukrishna.girish](#):
>
> system\_config table is not present.

That is not possible. Shopware could not work without that table. The table structure looks like that:

```auto
CREATE TABLE `system_config` (
  `id` binary(16) NOT NULL,
  `configuration_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `configuration_value` json NOT NULL,
  `sales_channel_id` binary(16) DEFAULT NULL,
  `created_at` datetime(3) NOT NULL,
  `updated_at` datetime(3) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `system_config`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq.system_config.configuration_key__sales_channel_id` (`configuration_key`,`sales_channel_id`),
  ADD KEY `fk.system_config.sales_channel_id` (`sales_channel_id`);

ALTER TABLE `system_config`
  ADD CONSTRAINT `fk.system_config.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

```

---

<div class="post-metadata">

**Author:** ![yedhukrishna.girish](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yedhukrishna.girish](https://forum.shopware.com/u/yedhukrishna.girish)\
**Post date:** [14. November 2023 um 09:15 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/5 "2023-11-14T09:15:38Z")

</div>

Thanks for the help. I did it.  
I just removed the foreign keys for the updation purpose.

I have done:

alter table `customer` drop FOREIGN key `fk.customer.bound_sales_channel_id`;

alter table `customer` drop FOREIGN key `fk.customer.sales_channel_id`;

alter table `newsletter_recipient` drop FOREIGN key `fk.newsletter_recipient.sales_channel_id`;

ALTER table `order` drop FOREIGN key `fk.order.sales_channel_id`;

Alter table `system_config` drop FOREIGN key `fk.system_config.sales_channel_id`;

Then after updating :

ALTER TABLE `customer`  
ADD CONSTRAINT `fk.customer.bound_sales_channel_id`  
FOREIGN KEY (`bound_sales_channel_id`)  
REFERENCES `sales_channel` (`id`);

ALTER TABLE `customer`  
ADD CONSTRAINT `fk.customer.sales_channel_id`  
FOREIGN KEY (`sales_channel_id`)  
REFERENCES `sales_channel` (`id`);

ALTER TABLE `newsletter_recipient`  
ADD CONSTRAINT `fk.newsletter_recipient.sales_channel_id`  
FOREIGN KEY (`sales_channel_id`)  
REFERENCES `sales_channel` (`id`);

ALTER TABLE `order`  
ADD CONSTRAINT `fk.order.sales_channel_id`  
FOREIGN KEY (`sales_channel_id`)  
REFERENCES `sales_channel` (`id`);

ALTER TABLE `system_config`  
ADD CONSTRAINT `fk.system_config.sales_channel_id`  
FOREIGN KEY (`sales_channel_id`)  
REFERENCES `sales_channel` (`id`);

And I was getting an error with System\_config table:  
ALTER TABLE `system_config`  
ADD CONSTRAINT `fk.system_config.sales_channel_id`  
FOREIGN KEY (`sales_channel_id`)  
REFERENCES `sales_channel` (`id`);  
MySQL reports: Documentation

#1452 - Cannot add or update child row: a foreign key condition fails (`test`.`#sql-5f2_1252a`, CONSTRAINT `fk.system_config.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id `))

Static analysis:

1 errors were found during the analysis.

Undetected ALTER operation. (near „;“ at position 81)  
SQL command: copy

ALTER TABLE `system_config` drop FOREIGN key `fk.system_config.sales_channel_id`;

MySQL reports: Documentation

#1064 - Error in SQL syntax. Please look up the correct syntax in the manual at ''fk.system\_config.sales\_channel\_id`' in line 1 alter table `system\_config`drop FOREIGN key`fk.system\_config.sales\_channel\_id`; MySQL reports: Documentation #1091 - DROP FOREIGN KEY: Cannot delete `fk.system\_config.sales\_channel\_id`. Does it exist?

How can i resolve this issue? And when I altered the tables  
CONSTRAINT `fk.customer.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) , the column is updated like this, but i need  
CONSTRAINT `fk.customer.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) ON UPDATE CASCADE . cascade part is not present.  
Also for system\_config table i need,  
CONSTRAINT `fk.system_config.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE , both update and delete cascade.  
How i can solve this?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [14. November 2023 um 16:15 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/6 "2023-11-14T16:15:05Z")

</div>

It looks like your tables are not complete anymore.

Download the Shopware version you have installed and then compare the database of the new installation with yours.

Hopefully you may can rebuild it then.

---

<div class="post-metadata">

**Author:** ![Bastiaan](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@Bastiaan](https://forum.shopware.com/u/Bastiaan)\
**Post date:** [11. November 2025 um 11:15 UTC](https://forum.shopware.com/t/issue-with-sales-channel-domain/101817/7 "2025-11-11T11:15:37Z")

</div>

@yedhukrishna.girish Did you ever resolve this?
