Before using civicrm, our organization was using an id which was unique for each member, While importing data to civicrm we imported it under external identifier.
So minimum and maximum external identifier range is as seen in the data below.
SELECT min(external_identifier),max(external_identifier), min(m.id),max(m.id) FROM civicrm_contact c, civicrm_membership m WHERE c.id = m.contact_id AND c.external_identifier != '' Where data is as follows
min value of external identifier 10527
max value of external identifier 17639
min valus of membership id 1185
max value of membership id 1972
I am planning to replace membership ids with external identifiers and then add auto incremental value using mysql to membership id which will be 17640 (based on max value of external identifer which is 17639). I see 3 tables civicrm_membership,civicrm_membership_block,civicrm_membership_payment,civicrm_membership_status and civicrm_membership_type Is there a way to do it ? I found a similar solution in below link but it happens to be dropping primary key, I just want to update primary key. https://stackoverflow.com/a/31942448/2673771
If the primary key happens to be an auto_increment value, you have to remove the auto increment, then drop the primary key then re-add the auto-increment
ALTER TABLE `civicrm_membership` MODIFY `id` INT, DROP PRIMARY KEY, ADD PRIMARY KEY (new_primary_key); then add back the auto increment ALTER TABLE `xx` ADD INDEX `auto_increment_field` (auto_increment_field), MODIFY `auto_increment_field` int auto_increment; then set auto increment back to previous value ALTER TABLE `xx` AUTO_INCREMENT = 5;