Changes between Version 15 and Version 16 of AdminTips


Ignore:
Timestamp:
2013-10-02T23:08:59Z (11 years ago)
Author:
Pan Luo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdminTips

    v15 v16  
    169169}}}
    170170
    171 === Merge Accounts by Id ===
     171=== Merge Student Accounts by Id ===
    172172{{{
    173173#!sql
     
    208208}}}
    209209
     210=== Merge Instructor/Admin Accounts by Id ===
     211{{{
     212#!sql
     213DROP PROCEDURE IF EXISTS merge_instructor_by_id;
     214
     215delimiter //
     216
     217CREATE PROCEDURE merge_instructor_by_id(IN target_id INT, IN source_id INT)
     218BEGIN
     219       DECLARE temp_id INT;
     220
     221       SELECT CONCAT("Merging user ", source_id, " into ", target_id) as "";
     222       UPDATE courses set creator_id = target_id where creator_id = source_id;
     223       UPDATE courses set updater_id = target_id where updater_id = source_id;
     224       UPDATE email_schedules set creator_id = target_id where creator_id = source_id;
     225       UPDATE email_templates set creator_id = target_id where creator_id = source_id;
     226       UPDATE email_templates set updater_id = target_id where updater_id = source_id;
     227       UPDATE events set creator_id = target_id where creator_id = source_id;
     228       UPDATE events set updater_id = target_id where updater_id = source_id;
     229       UPDATE groups set creator_id = target_id where creator_id = source_id;
     230       UPDATE groups set updater_id = target_id where updater_id = source_id;
     231       UPDATE IGNORE groups_members set user_id = target_id where user_id = source_id;
     232       UPDATE group_events set creator_id = target_id where creator_id = source_id;
     233       UPDATE group_events set updater_id = target_id where updater_id = source_id;
     234       UPDATE mixevals set creator_id = target_id where creator_id = source_id;
     235       UPDATE mixevals set updater_id = target_id where updater_id = source_id;
     236       UPDATE oauth_clients set user_id = target_id where user_id = source_id;
     237       UPDATE personalizes set user_id = target_id where user_id = source_id;
     238       UPDATE roles_users set user_id = target_id where user_id = source_id;
     239       UPDATE rubrics set creator_id = target_id where creator_id = source_id;
     240       UPDATE rubrics set updater_id = target_id where updater_id = source_id;
     241       UPDATE simple_evaluations set creator_id = target_id where creator_id = source_id;
     242       UPDATE simple_evaluations set updater_id = target_id where updater_id = source_id;
     243       UPDATE surveys set creator_id = target_id where creator_id = source_id;
     244       UPDATE surveys set updater_id = target_id where updater_id = source_id;
     245       UPDATE survey_group_members set user_id = target_id where user_id = source_id;
     246       UPDATE survey_inputs set user_id = target_id where user_id = source_id;
     247       UPDATE IGNORE user_courses set user_id = target_id where user_id = source_id;
     248       UPDATE user_courses set creator_id = target_id where creator_id = source_id;
     249       UPDATE user_courses set updater_id = target_id where updater_id = source_id;
     250       UPDATE IGNORE user_tutors set user_id = target_id where user_id = source_id;
     251       UPDATE user_tutors set creator_id = target_id where creator_id = source_id;
     252       UPDATE user_tutors set updater_id = target_id where updater_id = source_id;
     253       DELETE from user_faculties where user_id = source_id;
     254       DELETE from users where id = source_id LIMIT 1;
     255END//
     256
     257delimiter ;
     258}}}
     259
    210260=== Remove the Leading "s" in Username ===
    211261{{{