craftcms / craftcms/cms

SQL error when deleting a site

Open
#6,106 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

I get this error when deleting a site

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'primary' cannot be null
The SQL being executed was: UPDATE `craft_sites` SET `groupId`=1, `primary`=NULL, `name`=NULL, `handle`=NULL, `language`=NULL, `hasUrls`=NULL, `baseUrl`=NULL, `sortOrder`=NULL, `dateUpdated`='2020-05-19 11:46:05' WHERE `id`=6
Additional info
  • Craft version:3.4.18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report concerns deleting site 6 and shows an UPDATE against the craft_sites table that sets primary and other fields to NULL. Start by reproducing site deletion on Craft 3.4.18 and tracing the deletion path that issues this update. Done means deleting a site no longer raises the reported integrity-constraint error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.