Commit cc4f9565 authored by Matija Obreza's avatar Matija Obreza
Browse files

mariadb: CREATE TABLE .. SELECT.. kills the server

parent f3d71771
...@@ -1896,19 +1896,20 @@ databaseChangeLog: ...@@ -1896,19 +1896,20 @@ databaseChangeLog:
sql: >- sql: >-
update accession_historic a inner join taxonomy2 t on t.id=a.taxonomyId2 set a.genus = t.genus; update accession_historic a inner join taxonomy2 t on t.id=a.taxonomyId2 set a.genus = t.genus;
- changeSet: # BUG: This kills mariadb when running as non-root in cluster mode
id: 1531221360983-37a # - changeSet:
author: mobreza (generated) # id: 1531221360983-37a
comment: Move duplicates to accession_historic # author: mobreza (generated)
changes: # comment: Move duplicates to accession_historic
- sql: # changes:
sql: >- # - sql:
drop table if exists t_accessiondup; # sql: >-
create table t_accessiondup select min(id) minId from accession group by instituteId, genus, acceNumb having count(*) > 1; # drop table if exists t_accessiondup;
insert into accession_historic (id, acceNumb, seqNo, acqDate, acqSrc, available, duplSiteStr, inSGSV, inTrust, instCode, mlsStat, origCty, sampStat, storageStr, orgCtyId, instituteId, taxonomyId2, taxGenus, historic, createdDate, lastModifiedDate, createdBy, lastModifiedBy, version, acceurl, cropName, cropId, doi, active, genus, ancest, donorCode, donorName, donorNumb, names, otherIds) # create table t_accessiondup select min(id) minId from accession group by instituteId, genus, acceNumb having count(*) > 1;
select id, acceNumb, seqNo, acqDate, acqSrc, available, duplSiteStr, inSGSV, inTrust, instCode, mlsStat, origCty, sampStat, storageStr, orgCtyId, instituteId, taxonomyId2, taxGenus, historic, createdDate, lastModifiedDate, createdBy, lastModifiedBy, version, acceurl, cropName, cropId, doi, active, genus, ancest, donorCode, donorName, donorNumb, names, otherIds from accession where id in (select minId from t_accessiondup); # insert into accession_historic (id, acceNumb, seqNo, acqDate, acqSrc, available, duplSiteStr, inSGSV, inTrust, instCode, mlsStat, origCty, sampStat, storageStr, orgCtyId, instituteId, taxonomyId2, taxGenus, historic, createdDate, lastModifiedDate, createdBy, lastModifiedBy, version, acceurl, cropName, cropId, doi, active, genus, ancest, donorCode, donorName, donorNumb, names, otherIds)
delete from accession where id in (select minId from t_accessiondup); # select id, acceNumb, seqNo, acqDate, acqSrc, available, duplSiteStr, inSGSV, inTrust, instCode, mlsStat, origCty, sampStat, storageStr, orgCtyId, instituteId, taxonomyId2, taxGenus, historic, createdDate, lastModifiedDate, createdBy, lastModifiedBy, version, acceurl, cropName, cropId, doi, active, genus, ancest, donorCode, donorName, donorNumb, names, otherIds from accession where id in (select minId from t_accessiondup);
drop table t_accessiondup; # delete from accession where id in (select minId from t_accessiondup);
# drop table t_accessiondup;
- changeSet: - changeSet:
id: 1531221360983-37b1 id: 1531221360983-37b1
......
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