2 ALTER TABLE scores ADD COLUMN score_type varchar;
3 ALTER TABLE scores ADD COLUMN score_value integer;
4 ALTER TABLE scores ALTER COLUMN plot_score DROP NOT NULL;
5 ALTER TABLE scores ALTER COLUMN short_score DROP NOT NULL;
6 UPDATE scores SET score_type='d',plot_score=NULL,short_score=NULL WHERE short_score='TB draw';
7 UPDATE scores SET score_type='cp',score_value=0,plot_score=NULL,short_score=NULL WHERE short_score=' 0.00';
8 UPDATE scores SET score_type='m',score_value=substr(short_score,2)::integer,plot_score=NULL,short_score=NULL WHERE short_score LIKE 'M%';
9 UPDATE scores SET score_type='cp',score_value=REPLACE(short_score, '.', '')::integer,plot_score=NULL,short_score=NULL WHERE short_score IS NOT NULL;
10 ALTER TABLE scores DROP COLUMN plot_score;
11 ALTER TABLE scores DROP COLUMN short_score;
12 ALTER TABLE scores ALTER COLUMN score_type SET NOT NULL;