
-- Shinjuku custom fields ('sssssss-1111')
-- Custom variables 
-- custom_var17 = amount left that should be paid by the client
-- custom_var18 = leave_date and reason, format is not same in fields, not possible to divide and enter it into leave_date column
-- custom_var19 = payment_discount
-- custom_var20 = schedule 
update contacts set `custom_var1` = `custom_var17` where `school_id`='sssssss-1111';
update contacts set `custom_var2` = `custom_var18` where `school_id`='sssssss-1111';
update contacts set `custom_var3` = `custom_var19` where `school_id`='sssssss-1111';
update contacts set `custom_var4` = `custom_var20`  where `school_id`='sssssss-1111' and contact_status=0;
update contacts set `custom_var4` = `custom_var20`  where `school_id`='sssssss-1111' and contact_status=7;


-- Shinjuku custom fields for application 
-- Application Students == > contact_status = 5
-- custom_var20 - course name
-- 
update contacts set `custom_var8` = `custom_var20` where `school_id`='sssssss-1111' and contact_status=5;


-- Nagoya custom fields ('483794c4-adee-a607-f685-4441c943a1e2')
-- custom_var18=course
-- custom_var19=teacher name
-- custom_var20=course type
update contacts set `custom_var5` = `custom_var18` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2';
update contacts set `custom_var6` = `custom_var19` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2';
update contacts set `custom_var7` = `custom_var20` where `school_id`='483794c4-adee-a607-f685-4441c943a1e2';


update contacts set 
description=concat_ws('\r\n', `description`, concat('余った金額: ',`custom_var1`), concat('休校・退校日 理由: ',`custom_var2`)) 
where school_id='sssssss-1111';

UPDATE `contacts` SET description = NULL WHERE description = '余った金額: \r\n休校・退校日 理由: ' 

UPDATE contacts SET custom_var17=NULL where 1;
UPDATE contacts SET custom_var18=NULL where 1;
UPDATE contacts SET custom_var19=NULL where 1;
UPDATE contacts SET custom_var20=NULL where 1;

-- RECORD FOR DB UPDATE ON 2007.01.30
-- Course with ID 307553e7-13fd-9af1-826a-4590bc47bf1c has multiple instances at same time slots