branch develop updated (a596d2d -> dad5aa1)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git from a596d2d Livrable #8171 Merge branch 'feature/#8171' into develop new dad5aa1 Faire fonctionner la migration 3.905 sous pg (See #8171) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit dad5aa14fb72db3eba69ef77f003f705fd794d35 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri May 13 20:28:27 2016 +0200 Faire fonctionner la migration 3.905 sous pg (See #8171) Summary of changes: .../workingDb/WorkingDbMigrationCallBackForVersion3_905.java | 5 +++++ .../main/resources/migration/workingDb/3.905-1-insert-ports.sql | 7 ------- .../migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql | 7 +++++++ .../main/resources/migration/workingDb/pg/3.905-0-update-model.sql | 6 +++--- .../migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql | 7 +++++++ 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 echobase-domain/src/main/resources/migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql create mode 100644 echobase-domain/src/main/resources/migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit dad5aa14fb72db3eba69ef77f003f705fd794d35 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri May 13 20:28:27 2016 +0200 Faire fonctionner la migration 3.905 sous pg (See #8171) --- .../workingDb/WorkingDbMigrationCallBackForVersion3_905.java | 5 +++++ .../main/resources/migration/workingDb/3.905-1-insert-ports.sql | 7 ------- .../migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql | 7 +++++++ .../main/resources/migration/workingDb/pg/3.905-0-update-model.sql | 6 +++--- .../migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql | 7 +++++++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_905.java b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_905.java index fe8bcfe..a76ca9c 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_905.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_905.java @@ -11,6 +11,8 @@ import java.util.List; * Created on 26/04/16. * * @author Julien Ruchaud - ruchaud@codelutin.com + * @author Tony Chemit - chemit@codelutin.com + * @since 4.0 */ public class WorkingDbMigrationCallBackForVersion3_905 extends WorkingDbMigrationCallBackForVersionSupport { @@ -33,6 +35,9 @@ public class WorkingDbMigrationCallBackForVersion3_905 extends WorkingDbMigratio // insert port and update voyage table addScript("3.905-1-insert-ports.sql", queries); + // update voyage table + addSpecificScript("3.905-2-migrate-voyage-ports.sql", queries); + } } diff --git a/echobase-domain/src/main/resources/migration/workingDb/3.905-1-insert-ports.sql b/echobase-domain/src/main/resources/migration/workingDb/3.905-1-insert-ports.sql index 44c1f6f..c25c534 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/3.905-1-insert-ports.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/3.905-1-insert-ports.sql @@ -4894,10 +4894,3 @@ insert into port (topiaId, topiaVersion, topiaCreateDate, code, name, shortName, insert into port (topiaId, topiaVersion, topiaCreateDate, code, name, shortName, lastModification) values ('fr.ifremer.echobase.entities.references.Port#5553610280597#0.93226150254892', 0, '2016-04-29 00:00:00.000', 'BSH96', 'Honolulu', 'Honolulu', '2007-10-12 00:00:00.000'); insert into port (topiaId, topiaVersion, topiaCreateDate, code, name, shortName, lastModification) values ('fr.ifremer.echobase.entities.references.Port#5553610280597#0.93226150254893', 0, '2016-04-29 00:00:00.000', 'BSH97', 'Howth', 'Howth', '2007-10-16 00:00:00.000'); insert into port (topiaId, topiaVersion, topiaCreateDate, code, name, shortName, lastModification) values ('fr.ifremer.echobase.entities.references.Port#5553610280597#0.93226150254894', 0, '2016-04-29 00:00:00.000', 'BSH99', 'Istanbul', 'Istanbul', '2007-08-02 00:00:00.000'); - --- Change ports name -update voyage v SET (startPort) = (select p.topiaId from port p where upper(p.name) = upper(v.startPortName) limit 1); -update voyage v SET (endPort) = (select p.topiaId from port p where upper(p.name) = upper(v.endPortName) limit 1); - -alter table voyage drop column startPortName; -alter table voyage drop column endPortName; diff --git a/echobase-domain/src/main/resources/migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql b/echobase-domain/src/main/resources/migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql new file mode 100644 index 0000000..4e24c39 --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/h2/3.905-2-migrate-voyage-ports.sql @@ -0,0 +1,7 @@ +-- Change ports name +update voyage v SET startPort = (select p.topiaId from port p where upper(p.name) = upper(v.startPortName) limit 1); +update voyage v SET endPort = (select p.topiaId from port p where upper(p.name) = upper(v.endPortName) limit 1); + +-- Remove old port name columns +alter table voyage drop column startPortName; +alter table voyage drop column endPortName; diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-0-update-model.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-0-update-model.sql index 4bd5e3f..9143615 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-0-update-model.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-0-update-model.sql @@ -19,8 +19,8 @@ alter table voyage add column comments character varying(255); update voyage set northLimit = 0, eastLimit = 0, southLimit = 0, westLimit = 0, upLimit = 0, downLimit = 0; -- Change ports name -alter table voyage alter column startPort rename to startPortName; -alter table voyage alter column endPort rename to endPortName; +alter table voyage rename column startPort to startPortName; +alter table voyage rename column endPort to endPortName; alter table voyage add column startPort character varying(255); alter table voyage add column endPort character varying(255); @@ -35,7 +35,7 @@ alter table ancillaryInstrumentation add constraint PK_ANCILLARYINST primary key alter table ancillaryInstrumentation add constraint UK_ANCILLARYINST_SERIALNUMBER unique (serialNumber); -- TRANSECT -alter table transect alter column comment rename to comments; +alter table transect rename column comment to comments; alter table transect add column relatedActivity character varying(255); alter table transect add column units character varying(255); alter table transect add column zUnits character varying(255); diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql new file mode 100644 index 0000000..a3e5e3d --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.905-2-migrate-voyage-ports.sql @@ -0,0 +1,7 @@ +-- Change ports name +update voyage as v SET startPort = p.topiaid FROM ( select pp.topiaId, vv.topiaId as voyageId from port as pp, voyage as vv WHERE upper(pp.name) = upper(vv.startPortName) ) as p WHERE v.startPortName is not null and v.topiaId = p.voyageId; +update voyage as v SET endPort = p.topiaid FROM ( select pp.topiaId, vv.topiaId as voyageId from port as pp, voyage as vv WHERE upper(pp.name) = upper(vv.endPortName) ) as p WHERE v.endPortName is not null and v.topiaId = p.voyageId; + +-- Remove old port name columns +alter table voyage drop column startPortName; +alter table voyage drop column endPortName; \ No newline at end of file -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm