Commit 1f08b1fd authored by Matija Obreza's avatar Matija Obreza
Browse files

Schema updates

parent 590bad41
-- Availability
select Availability, count(*) from accession group by availability;
-- select Availability, count(*) from accession group by availability;
update accession set Availability=0 where Availability='N';
update accession set Availability=1 where Availability='Y';
......@@ -9,7 +9,7 @@ ALTER TABLE `accession` CHANGE COLUMN `Availability` `Availability` BIT NULL DEF
-- MLS_Status
select MLS_Status, count(*) from accession group by MLS_Status;
-- select MLS_Status, count(*) from accession group by MLS_Status;
ALTER TABLE `accession` CHANGE COLUMN `MLS_Status` `MLS_Status` char(1) NULL DEFAULT NULL COMMENT 'In MLS' ;
......@@ -20,7 +20,7 @@ update accession set MLS_Status=null where MLS_Status not in ('0', '1');
ALTER TABLE `accession` CHANGE COLUMN `MLS_Status` `MLS_Status` BIT NULL DEFAULT NULL COMMENT 'In MLS' ;
-- In_Svalbard
select In_Svalbard, count(*) from accession group by In_Svalbard;
-- select In_Svalbard, count(*) from accession group by In_Svalbard;
ALTER TABLE `accession` CHANGE COLUMN `In_Svalbard` `In_Svalbard` char(1) NULL DEFAULT NULL COMMENT 'In Svalbard' ;
......@@ -32,7 +32,7 @@ ALTER TABLE `accession` CHANGE COLUMN `In_Svalbard` `In_Svalbard` BIT NULL DEFAU
-- In_Trust
select In_Trust, count(*) from accession group by In_Trust;
-- select In_Trust, count(*) from accession group by In_Trust;
ALTER TABLE `accession` CHANGE COLUMN `In_Trust` `In_Trust` char(1) NULL DEFAULT NULL COMMENT 'Article 15 accession' ;
......
-- Add @Id, @Version to acq_collect, ...
ALTER TABLE `all_accnames` RENAME TO `accnames` ;
ALTER TABLE `all_acq_breeding` RENAME TO `acq_breeding` ;
ALTER TABLE `all_acq_collect` RENAME TO `acq_collect` ;
ALTER TABLE `all_acq_exchange` RENAME TO `acq_exchange` ;
ALTER TABLE `all_environment` RENAME TO `environment` ;
ALTER TABLE `acq_breeding` CHANGE COLUMN `version` `version` BIGINT NOT NULL DEFAULT 0,
ALTER TABLE `acq_breeding` ADD COLUMN `version` BIGINT NOT NULL DEFAULT 0,
CHANGE COLUMN `ALIS_Id` `ALIS_Id` BIGINT NOT NULL ,
ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT FIRST ,
DROP PRIMARY KEY ,
ADD PRIMARY KEY (`id`) ,
ADD UNIQUE INDEX `ALIS_Id_UNIQUE` (`ALIS_Id` ASC) ;
ALTER TABLE `acq_collect` CHANGE COLUMN `version` `version` BIGINT NOT NULL DEFAULT 0,
ALTER TABLE `acq_collect` ADD COLUMN `version` BIGINT NOT NULL DEFAULT 0,
CHANGE COLUMN `ALIS_Id` `ALIS_Id` BIGINT NOT NULL ,
ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT FIRST ,
DROP PRIMARY KEY ,
ADD PRIMARY KEY (`id`) ,
ADD UNIQUE INDEX `ALIS_Id_UNIQUE` (`ALIS_Id` ASC) ;
ALTER TABLE `acq_exchange` CHANGE COLUMN `version` `version` BIGINT NOT NULL DEFAULT 0,
ALTER TABLE `acq_exchange` ADD COLUMN `version` BIGINT NOT NULL DEFAULT 0,
CHANGE COLUMN `ALIS_Id` `ALIS_Id` BIGINT NOT NULL ,
ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT FIRST ,
DROP PRIMARY KEY ,
ADD PRIMARY KEY (`id`) ,
ADD UNIQUE INDEX `ALIS_Id_UNIQUE` (`ALIS_Id` ASC) ;
ALTER TABLE `environment` CHANGE COLUMN `version` `version` BIGINT NOT NULL DEFAULT 0,
ALTER TABLE `environment` ADD COLUMN `version` BIGINT NOT NULL DEFAULT 0,
CHANGE COLUMN `ALIS_Id` `ALIS_Id` BIGINT NOT NULL ,
ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT FIRST ,
DROP PRIMARY KEY ,
ADD PRIMARY KEY (`id`) ,
ADD UNIQUE INDEX `ALIS_Id_UNIQUE` (`ALIS_Id` ASC) ;
ALTER TABLE `accnames` CHANGE COLUMN `version` `version` BIGINT NOT NULL DEFAULT 0,
ALTER TABLE `accnames` ADD COLUMN `version` BIGINT NOT NULL DEFAULT 0,
CHANGE COLUMN `ALIS_Id` `ALIS_Id` BIGINT NOT NULL ,
ADD COLUMN `id` BIGINT NOT NULL AUTO_INCREMENT FIRST ,
DROP PRIMARY KEY ,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment