Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task to clean up DB inconsistencies: container and children with different languages #63

Open
sypets opened this issue Dec 1, 2023 · 0 comments

Comments

@sypets
Copy link
Contributor

sypets commented Dec 1, 2023

I split up issue #58 which contained both case to make it easier to handle.

The following inconsistencies should not happen and will cause elements to disappear (in list and page view):

  • elements in a gridelements container have a different sys_language_uid than the container

how inconsistencies might happen

For example, if users copy exsting gridelement with children to a column with different translation (using copy, insert, not translate button).

SQL

Find existing records:

SELECT tt1.uid,tt1.pid,tt1.header,tt1.sys_language_uid,tt2.uid,tt2.header,tt2.sys_language_uid 
  FROM tt_content tt1 
  INNER JOIN tt_content tt2 
    ON tt1.tx_gridelements_container = tt2.uid
  WHERE  not tt1.deleted 
    AND NOT tt2.deleted 
    AND tt1.tx_gridelements_container > 0
    AND tt1.colpos = -1
    AND tt2.ctype = 'gridelements_pi1'
    AND tt1.sys_language_uid != tt2.sys_language_uid
    AND tt1.sys_language_uid != -1
    AND tt2.sys_language_uid != -1;

fix:

UPDATE tt_content tt1 
  INNER JOIN tt_content tt2
    ON tt1.tx_gridelements_container = tt2.uid 
  SET tt1.sys_language_uid = tt2.sys_language_uid
  WHERE  not tt1.deleted 
    AND NOT tt2.deleted 
    AND tt1.tx_gridelements_container > 0 
    AND tt1.colpos = -1 
    AND tt2.ctype = 'gridelements_pi1' 
    AND tt1.sys_language_uid != tt2.sys_language_uid 
    AND tt1.sys_language_uid != -1 
    AND tt2.sys_language_uid != -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant