databaseChangeLog:
  - changeSet:
      id: drop_truncated_idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_time
      author: maverick
      preConditions:
        - onFail: MARK_RAN
        - indexExists:
            indexName: idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_
            tableName: dossier
      changes:
        - dropIndex:
            indexName: idx_dossier_dossier_template_id_soft_deleted_time_hard_deleted_
            tableName: dossier

  - changeSet:
      id: create_idx_dossiertemplid_softdeltime_harddeltime_archivtime
      author: maverick
      preConditions:
        - onFail: MARK_RAN
        - not:
            indexExists:
              indexName: idx_dossiertemplid_softdeltime_harddeltime_archivtime
              tableName: dossier
      changes:
        - createIndex:
            tableName: dossier
            indexName: idx_dossiertemplid_softdeltime_harddeltime_archivtime
            columns:
              - column:
                  name: dossier_template_id
              - column:
                  name: soft_deleted_time
              - column:
                  name: hard_deleted_time
              - column:
                  name: archived_time

  - changeSet:
      id: drop_truncated_idx_notification_preference_user_id_in_app_notifications_enabled
      author: maverick
      preConditions:
        - onFail: MARK_RAN
        - indexExists:
            indexName: idx_notification_preference_user_id_in_app_notifications_enable
            tableName: notification_preference
      changes:
        - dropIndex:
            indexName: idx_notification_preference_user_id_in_app_notifications_enable
            tableName: notification_preference

  - changeSet:
      id: create_idx_notify_pref_userid_app_notif_enabled
      author: maverick
      preConditions:
        - onFail: MARK_RAN
        - not:
            indexExists:
              indexName: idx_notify_pref_userid_app_notif_enabled
              tableName: notification_preference
      changes:
        - createIndex:
            tableName: notification_preference
            indexName: idx_notify_pref_userid_app_notif_enabled
            columns:
              - column:
                  name: user_id
              - column:
                  name: in_app_notifications_enabled
