Skip to content

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

Description

@sypets

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions