<commit_before>UPDATE version
   SET value = 11
 WHERE name = 'revision'
   AND value = 10
; %SPLIT%

DROP FUNCTION insertImage; %SPLIT%

ALTER TABLE image ADD COLUMN rb_smaj DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN rb_smin DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN rb_pa DOUBLE NULL; %SPLIT%

/* 
Although we know that the old values were incorrect due to wrong 
units and no stored conversion parameters, we copy them into 
the new columns.
TODO: Can we set those to rejected?
*/
UPDATE image
   SET bmaj_syn = 0
 WHERE bmaj_syn IS NULL
; %SPLIT%

UPDATE image
   SET bmin_syn = 0
 WHERE bmin_syn IS NULL
; %SPLIT%

UPDATE image
   SET bpa_syn = 0
 WHERE bpa_syn IS NULL
; %SPLIT%

UPDATE image
   SET rb_smaj = bmaj_syn
      ,rb_smin = bmin_syn
      ,rb_pa = bpa_syn
; %SPLIT%

UPDATE image
   SET deltax = 0
 WHERE deltax IS NULL
; %SPLIT%

UPDATE image
   SET deltay = 0
 WHERE deltay IS NULL
; %SPLIT%

ALTER TABLE image ALTER COLUMN rb_smaj SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN rb_smin SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN rb_pa SET NOT NULL; %SPLIT%

ALTER TABLE image ALTER COLUMN deltax SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN deltay SET NOT NULL; %SPLIT%

ALTER TABLE image DROP COLUMN bmaj_syn; %SPLIT%
ALTER TABLE image DROP COLUMN bmin_syn; %SPLIT%
ALTER TABLE image DROP COLUMN bpa_syn; %SPLIT%

CREATE FUNCTION insertImage(idataset INT
                           ,itau_time DOUBLE
                           ,ifreq_eff DOUBLE
                           ,ifreq_bw DOUBLE
                           ,itaustart_ts TIMESTAMP
                           ,irb_smaj DOUBLE
                           ,irb_smin DOUBLE
                           ,irb_pa DOUBLE
                           ,ideltax DOUBLE
                           ,ideltay DOUBLE
                           ,iurl VARCHAR(1024)
                           ,icentre_ra DOUBLE
                           ,icentre_decl DOUBLE
                           ,ixtr_radius DOUBLE
                           ) RETURNS INT
BEGIN

  DECLARE iimageid INT;<commit_msg>Fix for upgrade script 10_to_11<commit_after>UPDATE version
   SET value = 11
 WHERE name = 'revision'
   AND value = 10
; %SPLIT%

DROP FUNCTION insertImage; %SPLIT%

ALTER TABLE image ADD COLUMN rb_smaj DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN rb_smin DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN rb_pa DOUBLE NULL; %SPLIT%

ALTER TABLE image ADD COLUMN temp_deltax DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN temp_deltay DOUBLE NULL; %SPLIT%
/* 
Although we know that the old values were incorrect due to wrong 
units and no stored conversion parameters, we copy them into 
the new columns.
TODO: Can we set those to rejected?
*/
UPDATE image
   SET bmaj_syn = 0
 WHERE bmaj_syn IS NULL
; %SPLIT%

UPDATE image
   SET bmin_syn = 0
 WHERE bmin_syn IS NULL
; %SPLIT%

UPDATE image
   SET bpa_syn = 0
 WHERE bpa_syn IS NULL
; %SPLIT%

UPDATE image
   SET rb_smaj = bmaj_syn
      ,rb_smin = bmin_syn
      ,rb_pa = bpa_syn
; %SPLIT%

UPDATE image
   SET deltax = 0
 WHERE deltax IS NULL
; %SPLIT%

UPDATE image
   SET deltay = 0
 WHERE deltay IS NULL
; %SPLIT%

UPDATE image
   SET temp_deltax = deltax
      ,temp_deltay = deltay
; %SPLIT%

ALTER TABLE image ALTER COLUMN rb_smaj SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN rb_smin SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN rb_pa SET NOT NULL; %SPLIT%

ALTER TABLE image ALTER COLUMN temp_deltax SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN temp_deltay SET NOT NULL; %SPLIT%

ALTER TABLE image DROP COLUMN bmaj_syn; %SPLIT%
ALTER TABLE image DROP COLUMN bmin_syn; %SPLIT%
ALTER TABLE image DROP COLUMN bpa_syn; %SPLIT%

ALTER TABLE image DROP COLUMN deltax; %SPLIT%
ALTER TABLE image DROP COLUMN deltay; %SPLIT%

ALTER TABLE image ADD COLUMN deltax DOUBLE NULL; %SPLIT%
ALTER TABLE image ADD COLUMN deltay DOUBLE NULL; %SPLIT%

UPDATE image
   SET deltax = temp_deltax
      ,deltay = temp_deltay
; %SPLIT%

ALTER TABLE image DROP COLUMN temp_deltax; %SPLIT%
ALTER TABLE image DROP COLUMN temp_deltay; %SPLIT%

ALTER TABLE image ALTER COLUMN deltax SET NOT NULL; %SPLIT%
ALTER TABLE image ALTER COLUMN deltay SET NOT NULL; %SPLIT%

CREATE FUNCTION insertImage(idataset INT
                           ,itau_time DOUBLE
                           ,ifreq_eff DOUBLE
                           ,ifreq_bw DOUBLE
                           ,itaustart_ts TIMESTAMP
                           ,irb_smaj DOUBLE
                           ,irb_smin DOUBLE
                           ,irb_pa DOUBLE
                           ,ideltax DOUBLE
                           ,ideltay DOUBLE
                           ,iurl VARCHAR(1024)
                           ,icentre_ra DOUBLE
                           ,icentre_decl DOUBLE
                           ,ixtr_radius DOUBLE
                           ) RETURNS INT
BEGIN

  DECLARE iimageid INT;
{'fraction_non_alphanumeric': 0.04959349593495935, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 2.1933809214795588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4718244', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1668, 'n_words': 587}