Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/e6b888dd6ca1c38a28cbe51ecfc99682 to your computer and use it in GitHub Desktop.
Save peterjaap/e6b888dd6ca1c38a28cbe51ecfc99682 to your computer and use it in GitHub Desktop.
Delete core_config_data values where the fallback value in scope 0 is the same
DELETE FROM core_config_data WHERE config_id IN (SELECT config_id
FROM (SELECT DUPS.*
FROM core_config_data ORIG
LEFT JOIN core_config_data DUPS
ON ORIG.path = DUPS.path AND (ORIG.value = DUPS.value OR (ORIG.value IS NULL AND DUPS.value IS NULL))
AND DUPS.scope != "default" AND DUPS.scope_id != 0
WHERE ORIG.scope = "default"
AND ORIG.scope_id = 0
AND DUPS.path IS NOT NULL) as tmp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment