naboo / craft-siteduplicate

Site Duplicate let's you duplicate entries across Sites in Craft CMS. It even works when section entries aren't set to propagate across site sections making it easy to duplicate entry data between Sites.
MIT License
4 stars 1 forks source link

Integrity constraint violation #2

Closed MischaSz closed 5 years ago

MischaSz commented 5 years ago

Hi

I've just installed your plugin on one of our customer sites and wanted to test it with an entry. However, I receive the following error when duplicating the entry to another site:

Integrity constraint violation – yii\db\IntegrityException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' The SQL being executed was: UPDATE craft_content SET elementId=98698, siteId=2, title='Test Mischa', field_newsSubtitle=NULL, field_newsShorttext=NULL, field_newsImageCrop='left top', field_embedYoutubeVideo=NULL, field_newsShowHome='auto', field_newsShowCurrent='auto', field_showAds=1, field_showLogos=1, field_newsNewsletterDate=NULL, dateUpdated='2019-07-17 10:30:10' WHERE id='51959' Error Info: Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' ) ↵ Caused by: PDOException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' in /home//public_html//vendor/yiisoft/yii2/db/Command.php at line 1290

Any idea what the reason for the error could be?

Best, Mischa

naboo commented 5 years ago

Hi Mischa

What Craft version are you using?

Den ons 17 juli 2019 12:34MischaSz notifications@github.com skrev:

Hi

I've just installed your plugin on one of our customer sites and wanted to test it with an entry. However, I receive the following error when duplicating the entry to another site:

Integrity constraint violation – yii\db\IntegrityException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' The SQL being executed was: UPDATE craft_content SET elementId=98698, siteId=2, title='Test Mischa', field_newsSubtitle=NULL, field_newsShorttext=NULL, field_newsImageCrop='left top', field_embedYoutubeVideo=NULL, field_newsShowHome='auto', field_newsShowCurrent='auto', field_showAds=1, field_showLogos=1, field_newsNewsletterDate=NULL, dateUpdated='2019-07-17 10:30:10' WHERE id ='51959' Error Info: Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' ) ↵ Caused by: PDOException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '98698-2' for key 'craft_content_elementId_siteId_unq_idx' in /home//public_html//vendor/yiisoft/yii2/db/Command.php at line 1290

Any idea what the reason for the error could be?

Best, Mischa

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/naboo/craft-siteduplicate/issues/2?email_source=notifications&email_token=AAJJ3TNAEMLJZLIJFJTNXIDP73YRTA5CNFSM4IEO5M5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7WESVQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJJ3TMAYAV7IMNMS4IIFXLP73YRTANCNFSM4IEO5M5A .

MischaSz commented 5 years ago

PHP version 7.1.30 OS version Linux 3.10.0-962.3.2.lve1.5.25.10.el7.x86_64 Database driver & version MySQL 5.7.26 Image driver & version Imagick 3.4.3 (ImageMagick 6.9.4-10) Craft edition & version Craft Pro 3.1.29 Yii version 2.0.19 Twig version 2.11.2 Guzzle version 6.3.3 Imagine version 0.7-dev

naboo commented 5 years ago

Is this error happening across all sections or just one in particular?

The error is a little wierd and related to a duplicate index on the table - which shouldn't be something the Plugin has anything to do with.

Den ons 17 juli 2019 13:31MischaSz notifications@github.com skrev:

PHP version 7.1.30 OS version Linux 3.10.0-962.3.2.lve1.5.25.10.el7.x86_64 Database driver & version MySQL 5.7.26 Image driver & version Imagick 3.4.3 (ImageMagick 6.9.4-10) Craft edition & version Craft Pro 3.1.29 Yii version 2.0.19 Twig version 2.11.2 Guzzle version 6.3.3 Imagine version 0.7-dev

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/naboo/craft-siteduplicate/issues/2?email_source=notifications&email_token=AAJJ3TLK2N3LVSLPT4FNUSLP737J3A5CNFSM4IEO5M5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2D4TSY#issuecomment-512215499, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJJ3TIYQWSC6JAXQZASMNDP737J3ANCNFSM4IEO5M5A .

MischaSz commented 5 years ago

See https://github.com/craftcms/cms/issues/3716

It looks like this is a known issue with duplicateElements() in combination with supertables - should be solved in Craft 3.2

So we will wait for Craft 3.2. Thanks!

naboo commented 5 years ago

Perfect. I'll close this.