Changes between Version 14 and Version 15 of AdminTips


Ignore:
Timestamp:
2013-03-25T20:01:42Z (12 years ago)
Author:
Pan Luo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdminTips

    v14 v15  
    169169}}}
    170170
     171=== Merge Accounts by Id ===
     172{{{
     173#!sql
     174DROP PROCEDURE IF EXISTS merge_by_id;
     175
     176delimiter //
     177
     178CREATE PROCEDURE merge_by_id(IN target_id INT, IN source_id INT)
     179BEGIN
     180       DECLARE temp_id INT;
     181
     182       SELECT CONCAT("Merging user ", source_id, " into ", target_id) as "";
     183       UPDATE IGNORE groups_members set user_id = target_id where user_id = source_id;
     184       UPDATE IGNORE user_enrols set user_id = target_id where user_id = source_id;
     185                UPDATE IGNORE survey_group_members set user_id = target_id where user_id = source_id;
     186       UPDATE survey_inputs set user_id = target_id where user_id = source_id;
     187       UPDATE evaluation_submissions set submitter_id = target_id where submitter_id = source_id;
     188       UPDATE evaluation_simples set evaluator = target_id where evaluator = source_id;
     189       UPDATE evaluation_simples set evaluatee = target_id where evaluatee = source_id;
     190                UPDATE evaluation_simples set creator_id = target_id where creator_id = source_id;
     191                UPDATE evaluation_simples set updater_id = target_id where updater_id = source_id;
     192       UPDATE evaluation_rubrics set evaluator = target_id where evaluator = source_id;
     193       UPDATE evaluation_rubrics set evaluatee = target_id where evaluatee = source_id;
     194                UPDATE evaluation_rubrics set creator_id = target_id where creator_id = source_id;
     195                UPDATE evaluation_rubrics set updater_id = target_id where updater_id = source_id;
     196                UPDATE evaluation_rubric_details set creator_id = target_id where creator_id = source_id;
     197                UPDATE evaluation_rubric_details set updater_id = target_id where updater_id = source_id;
     198       UPDATE evaluation_mixevals set evaluator = target_id where evaluator = source_id;
     199       UPDATE evaluation_mixevals set evaluatee = target_id where evaluatee = source_id;
     200                UPDATE evaluation_mixevals set creator_id = target_id where creator_id = source_id;
     201                UPDATE evaluation_mixevals set updater_id = target_id where updater_id = source_id;
     202                UPDATE evaluation_mixeval_details set creator_id = target_id where creator_id = source_id;
     203                UPDATE evaluation_mixeval_details set updater_id = target_id where updater_id = source_id;
     204       DELETE from users where id = source_id LIMIT 1;
     205END//
     206
     207delimiter ;
     208}}}
     209
    171210=== Remove the Leading "s" in Username ===
    172211{{{