-- accounts and profiles are the tables where uid and pid are defined through an auto increment.
ALTER TABLE accounts MODIFY COLUMN uid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE profiles MODIFY COLUMN pid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;

-- Following tables all refer to accounts.uid.
ALTER TABLE account_auth_openid MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE account_lost_passwords MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE account_profiles MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE aliases MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE announce_read MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE announces MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE axletter_ins MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE axletter_rights MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE carvas MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE contacts MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE email_list_moderate MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE email_options MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE email_send_save MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE email_watch MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE emails MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE forum_innd MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE forum_profiles MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE forum_subs MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE group_announces MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE group_announces_read MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE group_event_participants MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE group_member_sub_requests MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE group_members MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE homonyms MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE ip_watch MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE log_last_sessions MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE log_sessions MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE newsletter_ins MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE payment_transactions MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_modifications MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_marketing MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_mstats MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_pending MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_subs MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE reminder MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE requests MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE requests_hidden MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE watch MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE watch_nonins MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE watch_promo MODIFY COLUMN uid INT(11) UNSIGNED DEFAULT NULL;

-- Following tables all refer to accounts.uid, but they use a different name.
ALTER TABLE contacts MODIFY COLUMN contact INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE email_list_moderate MODIFY COLUMN mid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE gapps_accounts MODIFY COLUMN l_userid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE gapps_queue MODIFY COLUMN q_owner_id INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE gapps_queue MODIFY COLUMN q_recipient_id INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE gapps_nicknames MODIFY COLUMN l_userid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE homonyms MODIFY COLUMN homonyme_id INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE log_sessions MODIFY COLUMN suid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_marketing MODIFY COLUMN sender INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE register_mstats MODIFY COLUMN sender INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE watch_nonins MODIFY COLUMN ni_id INT(11) UNSIGNED DEFAULT NULL;

-- Rename columns that should be called uid.
ALTER TABLE group_events CHANGE COLUMN organisateur_uid uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE survey_votes CHANGE COLUMN user_id uid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE surveys CHANGE COLUMN author_id uid INT(11) UNSIGNED DEFAULT NULL;

-- Following tables all refer to profiles.pid.
ALTER TABLE account_profiles MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE requests MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE search_name MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE watch_profile MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_addresses MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_binets MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_corps MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_display MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_education MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_job MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_job_term MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_langskills MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_medals MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_mentor MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_mentor_country MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_mentor_sector MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_mentor_term MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_modifications MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_name MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_networking MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_phones MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_photos MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;
ALTER TABLE profile_skills MODIFY COLUMN pid INT(11) UNSIGNED DEFAULT NULL;

-- vim:set syntax=mysql:
