Indexes on opush PostgreSQL tables

# Introduction

Deleting a paired mobile device through obm-ui has always been slow, until the new indexes included with [OBM 3.1.2](/blog/obm-312-out).
Some administrator could have added indexes manually on OBM installations as a workaround of the slow deletion.
You have to know that these indexes will be created again on your PostgreSQL database if they don't have the name expected by our migration script.
Impacted tables are _opush_folder_snapshot_ and _opush_folder_sync_state_backend_mapping_.

# Checking your tables

To avoid any performance loose, we advise to check your Opush tables.
If you have no indexes on these tables, your installation is ready for the 3.1.2 migration.
Else, be sure that NON PRIMARY-KEY indexes names are exactly like the following samples (else we advise you to drop theses indexes and let migration process recreate them):

obm=# \d opush_folder_snapshot
Column | Type | Modifiers
----------------------+---------+------------------------------------------------
id | integer | not null default nextval(...)
folder_sync_state_id | integer | not null
collection_id | integer | not null
Indexes:
"opush_folder_snapshot_pkey" PRIMARY KEY, btree (id)
"opush_folder_snapshot_collection_id_index" btree (collection_id)
"opush_folder_snapshot_folder_sync_state_id_index" btree (folder_sync_state_id)

and

obm=# \d opush_folder_sync_state_backend_mapping
Column | Type | Modifiers
----------------------+-----------------------------+-----------------------------
id | integer | not null default nextval(...)
data_type | pimdata_type | not null
folder_sync_state_id | integer | not null
last_sync | timestamp without time zone | not null
Indexes:
"opush_folder_sync_state_backend_mapping_pkey" PRIMARY KEY, btree (id)
"opush_folder_sync_state_backend_folder_sync_state_index" btree (folder_sync_state_id)
Foreign-key constraints:
"opush_folder_sync_state_backend_mappi_folder_sync_state_id_fkey" FOREIGN KEY (folder_sync_state_id) REFERENCES opush_folder_sync_state(id) ON DELETE CASCADEAir Max 95 VaporMax