Uploaded image for project: 'Confluence Server and Data Center'
  1. Confluence Server and Data Center
  2. CONFSERVER-38706

Confluence didn't create additional constraints and indice in DB for the first time setup

    XMLWordPrintable

Details

    Description

      NOTE: Should you're still seeing this issue in your Confluence instance (version 5.9.1 and above), please refer to the bug - CONFSERVER-58261: Missing unique constraints and index in fresh Confluence installation for further details.

      Summary

      When installing Confluence from scratch, additional constraints are not being added.

      Environment

      • PostgreSQL is being used as the database

      Steps to Reproduce

      1. Configure PostgreSQL as per Database Setup for PostgreSQL
      2. Install Confluence as per Confluence Installation Guide

      Expected Results

      The following constraints/indexes should exist on the tables:

      cwd_group:

      • cwd_group_name_dir_id

      cwd_user:

      • cwd_user_name_dir_id

      cwd_membership:

      • cwd_unique_user_membership
      • cwd_unique_group_membership

      cwd_group_attribute:

      • cwd_unique_grp_attr unique

      cwd_user_attribute:

      • cwd_unique_usr_attr unique

      content_perm:

      • cp_unique_user
      • cp_unique_group

      content_perm_set:

      • cps_unique_type

      bandana:

      • bandana_unique_key

      os_propertyentry:

      • ospe_entityid_idx

      Actual Results

      The above mentioned constraints are not present in the database.

      Workaround

      WARNING: Make sure to back up the database before applying any SQL commands that modify the database, and ensure Confluence is not running while applying the change

      For PostgreSQL, you can run the below SQL statements to add the missing constraints and indexes, assuming that the constraints haven't been broken in the mean time:

      -- Embedded Crowd constraints
      alter table cwd_group add constraint cwd_group_name_dir_id unique (lower_group_name, directory_id);
      alter table cwd_user add constraint cwd_user_name_dir_id unique (lower_user_name, directory_id);
      alter table cwd_membership add constraint cwd_unique_user_membership unique (parent_id, child_user_id);
      alter table cwd_membership add constraint cwd_unique_group_membership unique (parent_id, child_group_id);
      alter table cwd_group_attribute add constraint cwd_unique_grp_attr unique (directory_id, group_id, attribute_name, attribute_lower_value);
      alter table cwd_user_attribute add constraint cwd_unique_usr_attr unique (directory_id, user_id, attribute_name, attribute_lower_value);
      
      -- Content Permission constraints
      alter table CONTENT_PERM add constraint cp_unique_user unique (CPS_ID, CP_TYPE, USERNAME);
      alter table CONTENT_PERM add constraint cp_unique_group unique (CPS_ID, CP_TYPE, GROUPNAME);
      alter table CONTENT_PERM_SET add constraint cps_unique_type unique (CONTENT_ID, CONT_PERM_TYPE);
      
      -- Bandana constraints
      alter table BANDANA add constraint bandana_unique_key unique (BANDANACONTEXT, BANDANAKEY);
      
      -- Property Entry index
      create index ospe_entityid_idx on OS_PROPERTYENTRY (entity_id);
      

      Attachments

        Issue Links

          Activity

            People

              kcichocki K
              hta Hieu Ta (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: