-- rename tables
alter table sp_base_software_module rename to sp_software_module;
alter table sp_distributionset_tag rename to sp_distribution_set_tag;
alter table sp_ds_dstag rename to sp_ds_tag;
alter table sp_ds_module rename to sp_ds_sm;
alter table sp_rolloutgroup rename to sp_rollout_group;
alter table sp_rollouttargetgroup rename to sp_rollout_target_group;
alter table sp_sw_metadata rename to sp_sm_metadata;
alter table sp_target_type_ds_type_relation rename to sp_target_type_ds_type;
-- rename columns
alter table sp_action rename column rolloutgroup to rollout_group;
alter table sp_action_status_messages rename column action_status_id to action_status;
alter table sp_distribution_set rename column ds_id to ds_type;
alter table sp_ds_sm rename column module_id to sm_id;
alter table sp_ds_metadata rename column ds_id to ds;
alter table sp_ds_tag rename column TAG to tag;
alter table sp_rollout_group rename column parent_id to parent;
alter table sp_rollout_target_group rename column target_id to target;
alter table sp_rollout_target_group rename column rolloutgroup_id to rollout_group;
alter table sp_sm_metadata rename column sw_id to sm;
alter table sp_software_module rename column module_type to sm_type;
alter table sp_target_attributes rename column target_id to target;
alter table sp_target_conf_status rename column target_id to target;
alter table sp_target_metadata rename column target_id to target;
-- rename constraints
-- rename indexes
alter table sp_action rename index fk_action_ds to fk_action_distribution_set;
alter table sp_action rename index fk_action_rolloutgroup to fk_action_rollout_group;
alter table sp_action rename index fk_targ_act_hist_targ to fk_action_target;
alter table sp_action_status rename index fk_act_stat_action to fk_action_status_action;
alter table sp_action_status_messages rename index sp_idx_action_status_msgs_01 to fk_action_status_messages_action_status;
alter table sp_artifact rename index fk_assigned_sm to fk_artifact_software_module;
alter table sp_distribution_set rename index uk_distrib_set to uk_distribution_set;
alter table sp_distribution_set rename index fk_ds_dstype_ds to fk_distribution_set_ds_type;
alter table sp_distribution_set_tag rename index uk_ds_tag to uk_distribution_set_tag;
alter table sp_distribution_set_type rename index uk_dst_key to uk_distribution_set_type_type_key;
alter table sp_distribution_set_type rename index uk_dst_name to uk_distribution_set_type_name;
alter table sp_ds_sm rename index fk_ds_module_module to fk_ds_sm_sm_id;
alter table sp_ds_tag rename index fk_ds_dstag_tag to fk_ds_tag_tag;
alter table sp_ds_type_element rename index fk_ds_type_element_smtype to fk_ds_type_element_software_module_type;
alter table sp_rollout rename index fk_rollout_ds to fk_rollout_distribution_set;
alter table sp_rollout_group rename index uk_rolloutgroup to uk_rollout_group;
alter table sp_rollout_group rename index fk_rolloutgroup_rollout to fk_rollout_group_rollout;
alter table sp_rollout_group rename index fk_rolloutgroup_rolloutgroup to sp_idx_rollout_group_parent;
alter table sp_rollout_target_group rename index fk_rollouttargetgroup_target to fk_rollout_target_group_target;
alter table sp_sm_metadata rename index fk_metadata_sw to fk_sm_metadata_sm;
alter table sp_software_module rename index uk_base_sw_mod to uk_software_module;
alter table sp_software_module_type rename index uk_smt_type_key to uk_software_module_type_type_key;
alter table sp_software_module_type rename index uk_smt_name to uk_software_module_type_name;
alter table sp_software_module rename index sp_idx_base_sw_module_prim to sp_idx_software_module_prim;
alter table sp_software_module rename index sp_idx_base_sw_module_01 to sp_idx_software_module_01;
alter table sp_software_module rename index sp_idx_base_sw_module_02 to sp_idx_software_module_02;
alter table sp_target rename index uk_tenant_controller_id to uk_target_controller_id;
alter table sp_target_conf_status rename index fk_target_auto_conf to fk_target_conf_status_target;
alter table sp_target_filter_query rename index uk_tenant_custom_filter_name to uk_target_filter_query;
alter table sp_target_filter_query rename index fk_filter_auto_assign_ds to fk_target_filter_query_auto_assign_distribution_set;
alter table sp_target_tag rename index uk_targ_tag to uk_target_tag;
alter table sp_target_target_tag rename index fk_targ_targtag_tag to fk_target_target_tag_tag;
alter table sp_target_type rename index uk_target_type_name to uk_target_name;
alter table sp_target_type_ds_type rename index fk_target_type_relation_ds_type to fk_target_type_ds_type_distribution_set_type;
alter table sp_tenant rename index uk_tenantmd_tenant to uk_tenant;
alter table sp_tenant rename index fk_tenant_md_default_ds_type to fk_tenant_default_ds_type;
alter table sp_tenant_configuration rename index uk_tenant_key to uk_tenant_configuration;