Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
ead78f21
by Tony Chemit at 2023-06-25T17:19:52+02:00
5 changed files:
- + client/runner/src/main/assembly/dist/scripts/postgresql/drop-postgis.sql
- client/runner/src/main/assembly/dist/scripts/postgresql/extra/01_0_create-postgis-functions.sql
- client/runner/src/main/assembly/dist/scripts/postgresql/extra/01_1_create-postgis-referential.sql
- client/runner/src/main/assembly/dist/scripts/postgresql/extra/01_2_create-postgis-ps.sql
- client/runner/src/main/assembly/dist/scripts/postgresql/extra/01_3_create-postgis-ll.sql
Changes:
| 1 | +ALTER table common.Harbour DROP COLUMN the_geom CASCADE;
|
|
| 2 | +ALTER TABLE ps_observation.activity DROP COLUMN the_geom CASCADE;
|
|
| 3 | +ALTER TABLE ps_observation.transmittingbuoy DROP COLUMN the_geom CASCADE;
|
|
| 4 | +ALTER TABLE ps_logbook.activity DROP COLUMN the_geom CASCADE;
|
|
| 5 | +ALTER TABLE ps_logbook.activity DROP COLUMN the_geom_original CASCADE;
|
|
| 6 | +ALTER TABLE ps_logbook.transmittingbuoy DROP COLUMN the_geom CASCADE;
|
|
| 7 | +ALTER TABLE ll_observation.activity DROP COLUMN the_geom CASCADE;
|
|
| 8 | +ALTER TABLE ll_observation.set DROP COLUMN the_geom_settingstart CASCADE;
|
|
| 9 | +ALTER TABLE ll_observation.set DROP COLUMN the_geom_settingend CASCADE;
|
|
| 10 | +ALTER TABLE ll_observation.set DROP COLUMN the_geom_haulingstart CASCADE;
|
|
| 11 | +ALTER TABLE ll_observation.set DROP COLUMN the_geom_haulingend CASCADE;
|
|
| 12 | +ALTER TABLE ll_logbook.activity DROP COLUMN the_geom CASCADE;
|
|
| 13 | +ALTER TABLE ll_logbook.set DROP COLUMN the_geom_settingstart CASCADE;
|
|
| 14 | +ALTER TABLE ll_logbook.set DROP COLUMN the_geom_settingend CASCADE;
|
|
| 15 | +ALTER TABLE ll_logbook.set DROP COLUMN the_geom_haulingstart CASCADE;
|
|
| 16 | +ALTER TABLE ll_logbook.set DROP COLUMN the_geom_haulingend CASCADE;
|
|
| 17 | +ALTER TABLE ll_landing.landing DROP COLUMN the_geom CASCADE; |
| ... | ... | @@ -41,7 +41,7 @@ BEGIN |
| 41 | 41 | return NEW;
|
| 42 | 42 | END IF;
|
| 43 | 43 | RAISE NOTICE 'Will compute the_geom for %.% % - latitude % and longitude %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.latitude, NEW.longitude;
|
| 44 | - NEW.the_geom := ST_SetSRID(ST_MakePoint(NEW.longitude, NEW.latitude), 4326);
|
|
| 44 | + NEW.the_geom := ST_SetSRID(ST_MakePoint(NEW.longitude::double precision, NEW.latitude::double precision), 4326);
|
|
| 45 | 45 | RAISE NOTICE 'Computed for %.% % latitude % and longitude %, the_geom %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.latitude, NEW.longitude, NEW.the_geom;
|
| 46 | 46 | RETURN NEW;
|
| 47 | 47 | END
|
| ... | ... | @@ -69,7 +69,7 @@ BEGIN |
| 69 | 69 | return NEW;
|
| 70 | 70 | END IF;
|
| 71 | 71 | RAISE NOTICE 'Will compute the_geom for %.% % - latitudeOriginal % and longitudeOriginal %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.latitudeOriginal, NEW.longitudeOriginal;
|
| 72 | - NEW.the_geom_original := ST_SetSRID(ST_MakePoint(NEW.longitudeOriginal, NEW.latitudeOriginal), 4326);
|
|
| 72 | + NEW.the_geom_original := ST_SetSRID(ST_MakePoint(NEW.longitudeOriginal::double precision, NEW.latitudeOriginal::double precision), 4326);
|
|
| 73 | 73 | RAISE NOTICE 'Computed for %.% % latitudeOriginal % and longitudeOriginal %, the_geom_original %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.latitudeOriginal, NEW.longitudeOriginal, NEW.the_geom_original;
|
| 74 | 74 | RETURN NEW;
|
| 75 | 75 | END
|
| ... | ... | @@ -98,7 +98,7 @@ BEGIN |
| 98 | 98 | return NEW;
|
| 99 | 99 | END IF;
|
| 100 | 100 | RAISE NOTICE 'Will compute the_geom for %.% % - settingStartLatitude % and settingStartLongitude %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.settingStartLatitude, NEW.settingStartLongitude;
|
| 101 | - NEW.the_geom_settingStart := ST_SetSRID(ST_MakePoint(NEW.settingStartLongitude, NEW.settingStartLatitude), 4326);
|
|
| 101 | + NEW.the_geom_settingStart := ST_SetSRID(ST_MakePoint(NEW.settingStartLongitude::double precision, NEW.settingStartLatitude::double precision), 4326);
|
|
| 102 | 102 | RAISE NOTICE 'Computed for %.% % settingStartLatitude % and settingStartLongitude %, the_geom_settingStart %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.settingStartLatitude, NEW.settingStartLongitude, NEW.the_geom_settingStart;
|
| 103 | 103 | RETURN NEW;
|
| 104 | 104 | END
|
| ... | ... | @@ -126,7 +126,7 @@ BEGIN |
| 126 | 126 | return NEW;
|
| 127 | 127 | END IF;
|
| 128 | 128 | RAISE NOTICE 'Will compute the_geom for %.% % - settingEndLatitude % and settingEndLongitude %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.settingEndLatitude, NEW.settingEndLongitude;
|
| 129 | - NEW.the_geom_settingEnd := ST_SetSRID(ST_MakePoint(NEW.settingEndLongitude, NEW.settingEndLatitude), 4326);
|
|
| 129 | + NEW.the_geom_settingEnd := ST_SetSRID(ST_MakePoint(NEW.settingEndLongitude::double precision, NEW.settingEndLatitude::double precision), 4326);
|
|
| 130 | 130 | RAISE NOTICE 'Computed for %.% % settingEndLatitude % and settingEndLongitude %, the_geom_settingEnd %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.settingEndLatitude, NEW.settingEndLongitude, NEW.the_geom_settingEnd;
|
| 131 | 131 | RETURN NEW;
|
| 132 | 132 | END
|
| ... | ... | @@ -154,7 +154,7 @@ BEGIN |
| 154 | 154 | return NEW;
|
| 155 | 155 | END IF;
|
| 156 | 156 | RAISE NOTICE 'Will compute the_geom for %.% % - haulingStartLatitude % and haulingStartLongitude %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.haulingStartLatitude, NEW.haulingStartLongitude;
|
| 157 | - NEW.the_geom_haulingStart := ST_SetSRID(ST_MakePoint(NEW.haulingStartLongitude, NEW.haulingStartLatitude), 4326);
|
|
| 157 | + NEW.the_geom_haulingStart := ST_SetSRID(ST_MakePoint(NEW.haulingStartLongitude::double precision, NEW.haulingStartLatitude::double precision), 4326);
|
|
| 158 | 158 | RAISE NOTICE 'Computed for %.% % haulingStartLatitude % and haulingStartLongitude %, the_geom_haulingStart %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.haulingStartLatitude, NEW.haulingStartLongitude, NEW.the_geom_haulingStart;
|
| 159 | 159 | RETURN NEW;
|
| 160 | 160 | END
|
| ... | ... | @@ -182,7 +182,7 @@ BEGIN |
| 182 | 182 | return NEW;
|
| 183 | 183 | END IF;
|
| 184 | 184 | RAISE NOTICE 'Will compute the_geom for %.% % - haulingEndLatitude % and haulingEndLongitude %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.haulingEndLatitude, NEW.haulingEndLongitude;
|
| 185 | - NEW.the_geom_haulingEnd := ST_SetSRID(ST_MakePoint(NEW.haulingEndLongitude, NEW.haulingEndLatitude), 4326);
|
|
| 185 | + NEW.the_geom_haulingEnd := ST_SetSRID(ST_MakePoint(NEW.haulingEndLongitude::double precision, NEW.haulingEndLatitude::double precision), 4326);
|
|
| 186 | 186 | RAISE NOTICE 'Computed for %.% % haulingEndLatitude % and haulingEndLongitude %, the_geom_haulingEnd %', TG_TABLE_SCHEMA, TG_TABLE_NAME, NEW.topiaId, NEW.haulingEndLatitude, NEW.haulingEndLongitude, NEW.the_geom_haulingEnd;
|
| 187 | 187 | RETURN NEW;
|
| 188 | 188 | END
|
| ... | ... | @@ -19,9 +19,8 @@ |
| 19 | 19 | -- <http://www.gnu.org/licenses/gpl-3.0.html>.
|
| 20 | 20 | -- #L%
|
| 21 | 21 | ---
|
| 22 | - |
|
| 23 | -SELECT AddGeometryColumn('common', 'harbour', 'the_geom', 4326, 'POINT', 2);
|
|
| 22 | +ALTER TABLE common.harbour ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 24 | 23 | CREATE INDEX IF NOT EXISTS idx_harbour_gist ON common.harbour USING GIST (the_geom);
|
| 25 | 24 | DROP TRIGGER IF EXISTS tr_sync_common_harbour_the_geom ON common.harbour;
|
| 26 | 25 | CREATE TRIGGER tr_sync_common_harbour_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON common.harbour FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 27 | -UPDATE common.harbour SET the_geom = ST_SetSRID(ST_MakePoint(longitude,latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL; |
|
| 26 | +UPDATE common.harbour SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision,latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL; |
| ... | ... | @@ -20,33 +20,33 @@ |
| 20 | 20 | -- #L%
|
| 21 | 21 | ---
|
| 22 | 22 | |
| 23 | -SELECT AddGeometryColumn('ps_observation', 'activity', 'the_geom', 4326, 'POINT', 2);
|
|
| 23 | +ALTER TABLE ps_observation.activity ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 24 | 24 | CREATE INDEX IF NOT EXISTS idx_ps_observation_activity_gist ON ps_observation.activity USING GIST (the_geom);
|
| 25 | 25 | DROP TRIGGER IF EXISTS tr_sync_ps_observation_activity_the_geom ON ps_observation.activity;
|
| 26 | 26 | CREATE TRIGGER tr_sync_ps_observation_activity_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ps_observation.activity FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 27 | -UPDATE ps_observation.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude,latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 27 | +UPDATE ps_observation.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision,latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 28 | 28 | |
| 29 | -SELECT AddGeometryColumn('ps_observation', 'transmittingbuoy', 'the_geom', 4326, 'POINT', 2);
|
|
| 29 | +ALTER TABLE ps_observation.transmittingbuoy ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 30 | 30 | CREATE INDEX IF NOT EXISTS idx_ps_observation_transmittingbuoy_gist ON ps_observation.TransmittingBuoy USING GIST (the_geom);
|
| 31 | 31 | DROP TRIGGER IF EXISTS tr_sync_ps_observation_transmittingbuoy_the_geom ON ps_observation.TransmittingBuoy;
|
| 32 | 32 | CREATE TRIGGER tr_sync_ps_observation_transmittingbuoy_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ps_observation.TransmittingBuoy FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 33 | -UPDATE ps_observation.TransmittingBuoy SET the_geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 33 | +UPDATE ps_observation.TransmittingBuoy SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision, latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | -SELECT AddGeometryColumn('ps_logbook' ,'activity', 'the_geom', 4326, 'POINT', 2);
|
|
| 36 | +ALTER TABLE ps_logbook.activity ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 37 | 37 | CREATE INDEX IF NOT EXISTS idx_ps_logbook_activity_gist ON ps_logbook.activity USING GIST (the_geom);
|
| 38 | 38 | DROP TRIGGER IF EXISTS tr_sync_ps_logbook_activity_the_geom ON ps_logbook.activity;
|
| 39 | 39 | CREATE TRIGGER tr_sync_ps_logbook_activity_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ps_logbook.activity FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 40 | -UPDATE ps_logbook.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude,latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 40 | +UPDATE ps_logbook.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision,latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
|
| 41 | 41 | |
| 42 | -SELECT AddGeometryColumn('ps_logbook','activity', 'the_geom_original', 4326, 'POINT', 2);
|
|
| 42 | +ALTER TABLE ps_logbook.activity ADD COLUMN the_geom_original geometry(Point, 4326);
|
|
| 43 | 43 | CREATE INDEX IF NOT EXISTS idx_ps_logbook_activity_original_gist ON ps_logbook.activity USING GIST (the_geom_original);
|
| 44 | 44 | DROP TRIGGER IF EXISTS tr_sync_ps_logbook_activity_the_geom_original ON ps_logbook.activity;
|
| 45 | 45 | CREATE TRIGGER tr_sync_ps_logbook_activity_the_geom_original BEFORE INSERT OR UPDATE OF latitudeOriginal, longitudeOriginal ON ps_logbook.activity FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_original();
|
| 46 | -UPDATE ps_logbook.activity SET the_geom_original = ST_SetSRID(ST_MakePoint(latitudeOriginal, longitudeOriginal), 4326) WHERE latitudeOriginal IS NOT NULL AND longitudeOriginal IS NOT NULL AND the_geom_original IS NULL;
|
|
| 46 | +UPDATE ps_logbook.activity SET the_geom_original = ST_SetSRID(ST_MakePoint(latitudeOriginal::double precision, longitudeOriginal::double precision), 4326) WHERE latitudeOriginal IS NOT NULL AND longitudeOriginal IS NOT NULL AND the_geom_original IS NULL;
|
|
| 47 | 47 | |
| 48 | -SELECT AddGeometryColumn('ps_logbook', 'transmittingbuoy', 'the_geom', 4326, 'POINT', 2);
|
|
| 48 | +ALTER TABLE ps_logbook.transmittingbuoy ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 49 | 49 | CREATE INDEX IF NOT EXISTS idx_ps_logbook_transmittingbuoy_gist ON ps_logbook.TransmittingBuoy USING GIST (the_geom);
|
| 50 | 50 | DROP TRIGGER IF EXISTS tr_sync_ps_logbook_transmittingbuoy_the_geom ON ps_logbook.TransmittingBuoy;
|
| 51 | 51 | CREATE TRIGGER tr_sync_ps_logbook_transmittingbuoy_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ps_logbook.TransmittingBuoy FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 52 | -UPDATE ps_logbook.TransmittingBuoy SET the_geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL; |
|
| 52 | +UPDATE ps_logbook.TransmittingBuoy SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision, latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL; |
| ... | ... | @@ -20,72 +20,72 @@ |
| 20 | 20 | -- #L%
|
| 21 | 21 | ---
|
| 22 | 22 | |
| 23 | -SELECT AddGeometryColumn('ll_observation', 'activity', 'the_geom', 4326, 'POINT', 2);
|
|
| 23 | +ALTER TABLE ll_observation.activity ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 24 | 24 | CREATE INDEX IF NOT EXISTS idx_ll_observation_activity_gist ON ll_observation.activity USING GIST (the_geom);
|
| 25 | 25 | DROP TRIGGER IF EXISTS tr_sync_ll_observation_activity_the_geom ON ll_observation.activity;
|
| 26 | 26 | CREATE TRIGGER tr_sync_ll_observation_activity_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ll_observation.activity FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 27 | -UPDATE ll_observation.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) AND the_geom IS NULL;
|
|
| 27 | +UPDATE ll_observation.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision, latitude::double precision), 4326) WHERE the_geom IS NULL;
|
|
| 28 | 28 | |
| 29 | -SELECT AddGeometryColumn('ll_observation', 'set', 'the_geom_settingstart', 4326, 'POINT', 2);
|
|
| 29 | +ALTER TABLE ll_observation.set ADD COLUMN the_geom_settingstart geometry(Point, 4326);
|
|
| 30 | 30 | DROP INDEX IF EXISTS idx_ll_observation_set_gist_settingstart;
|
| 31 | 31 | CREATE INDEX IF NOT EXISTS idx_ll_observation_set_gist_settingstart ON ll_observation.set USING GIST (the_geom_settingstart);
|
| 32 | 32 | DROP TRIGGER IF EXISTS tr_sync_ll_observation_set_the_geom_settingstart ON ll_observation.set;
|
| 33 | 33 | CREATE TRIGGER tr_sync_ll_observation_set_the_geom_settingstart BEFORE INSERT OR UPDATE OF settingStartLatitude, settingStartLongitude ON ll_observation.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_settingStart();
|
| 34 | -UPDATE ll_observation.set SET the_geom_settingstart = ST_SetSRID(ST_MakePoint(settingStartLongitude, settingStartLatitude), 4326) AND the_geom_settingstart IS NULL;
|
|
| 34 | +UPDATE ll_observation.set SET the_geom_settingstart = ST_SetSRID(ST_MakePoint(settingStartLongitude::double precision, settingStartLatitude::double precision), 4326) WHERE the_geom_settingstart IS NULL;
|
|
| 35 | 35 | |
| 36 | -SELECT AddGeometryColumn('ll_observation', 'set', 'the_geom_settingend', 4326, 'POINT', 2);
|
|
| 36 | +ALTER TABLE ll_observation.set ADD COLUMN the_geom_settingend geometry(Point, 4326);
|
|
| 37 | 37 | DROP INDEX IF EXISTS idx_ll_observation_set_gist_settingend;
|
| 38 | 38 | CREATE INDEX IF NOT EXISTS idx_ll_observation_set_gist_settingend ON ll_observation.set USING GIST (the_geom_settingend);
|
| 39 | 39 | DROP TRIGGER IF EXISTS tr_sync_ll_observation_set_the_geom_settingend ON ll_observation.set;
|
| 40 | 40 | CREATE TRIGGER tr_sync_ll_observation_set_the_geom_settingend BEFORE INSERT OR UPDATE OF settingEndLatitude, settingEndLongitude ON ll_observation.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_settingEnd();
|
| 41 | -UPDATE ll_observation.set SET the_geom_settingend = ST_SetSRID(ST_MakePoint(settingEndLongitude, settingEndLatitude), 4326) AND the_geom_settingend IS NULL;
|
|
| 41 | +UPDATE ll_observation.set SET the_geom_settingend = ST_SetSRID(ST_MakePoint(settingEndLongitude::double precision, settingEndLatitude::double precision), 4326) WHERE the_geom_settingend IS NULL;
|
|
| 42 | 42 | |
| 43 | -SELECT AddGeometryColumn('ll_observation', 'set', 'the_geom_haulingstart', 4326, 'POINT', 2);
|
|
| 43 | +ALTER TABLE ll_observation.set ADD COLUMN the_geom_haulingstart geometry(Point, 4326);
|
|
| 44 | 44 | DROP INDEX IF EXISTS idx_ll_observation_set_gist_haulingstart;
|
| 45 | 45 | CREATE INDEX IF NOT EXISTS idx_ll_observation_set_gist_haulingstart ON ll_observation.set USING GIST (the_geom_haulingstart);
|
| 46 | 46 | DROP TRIGGER IF EXISTS tr_sync_ll_observation_set_the_geom_haulingstart ON ll_observation.set;
|
| 47 | 47 | CREATE TRIGGER tr_sync_ll_observation_set_the_geom_haulingstart BEFORE INSERT OR UPDATE OF haulingStartLatitude, haulingStartLongitude ON ll_observation.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_haulingStart();
|
| 48 | -UPDATE ll_observation.set SET the_geom_haulingstart = ST_SetSRID(ST_MakePoint(haulingStartLongitude, haulingStartLatitude), 4326) AND the_geom_haulingstart IS NULL;
|
|
| 48 | +UPDATE ll_observation.set SET the_geom_haulingstart = ST_SetSRID(ST_MakePoint(haulingStartLongitude::double precision, haulingStartLatitude::double precision), 4326) WHERE the_geom_haulingstart IS NULL;
|
|
| 49 | 49 | |
| 50 | -SELECT AddGeometryColumn('ll_observation', 'set', 'the_geom_haulingend', 4326, 'POINT', 2);
|
|
| 50 | +ALTER TABLE ll_observation.set ADD COLUMN the_geom_haulingend geometry(Point, 4326);
|
|
| 51 | 51 | DROP INDEX IF EXISTS idx_ll_observation_set_gist_haulingend;
|
| 52 | 52 | CREATE INDEX IF NOT EXISTS idx_ll_observation_set_gist_haulingend ON ll_observation.set USING GIST (the_geom_haulingend);
|
| 53 | 53 | DROP TRIGGER IF EXISTS tr_sync_ll_observation_set_the_geom_haulingend ON ll_observation.set;
|
| 54 | 54 | CREATE TRIGGER tr_sync_ll_observation_set_the_geom_haulingend BEFORE INSERT OR UPDATE OF haulingEndLatitude, haulingEndLongitude ON ll_observation.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_haulingEnd();
|
| 55 | -UPDATE ll_observation.set SET the_geom_haulingend = ST_SetSRID(ST_MakePoint(haulingEndLongitude, haulingEndLatitude), 4326) AND the_geom_haulingend IS NULL;
|
|
| 55 | +UPDATE ll_observation.set SET the_geom_haulingend = ST_SetSRID(ST_MakePoint(haulingEndLongitude::double precision, haulingEndLatitude::double precision), 4326) WHERE the_geom_haulingend IS NULL;
|
|
| 56 | 56 | |
| 57 | -SELECT AddGeometryColumn('ll_logbook', 'activity', 'the_geom', 4326, 'POINT', 2);
|
|
| 57 | +ALTER TABLE ll_logbook.activity ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 58 | 58 | CREATE INDEX IF NOT EXISTS idx_ll_logbook_activity_gist ON ll_logbook.activity USING GIST (the_geom);
|
| 59 | 59 | DROP TRIGGER IF EXISTS tr_sync_ll_logbook_activity_the_geom ON ll_logbook.activity;
|
| 60 | 60 | CREATE TRIGGER tr_sync_ll_logbook_activity_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ll_logbook.activity FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 61 | 61 | UPDATE ll_logbook.activity SET the_geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL;
|
| 62 | 62 | |
| 63 | -SELECT AddGeometryColumn('ll_logbook', 'set', 'the_geom_settingstart', 4326, 'POINT', 2);
|
|
| 63 | +ALTER TABLE ll_logbook.set ADD COLUMN the_geom_settingstart geometry(Point, 4326);
|
|
| 64 | 64 | CREATE INDEX IF NOT EXISTS idx_ll_logbook_set_gist_settingstart ON ll_logbook.set USING GIST (the_geom_settingstart);
|
| 65 | 65 | DROP TRIGGER IF EXISTS tr_sync_ll_logbook_set_the_geom_settingstart ON ll_logbook.set;
|
| 66 | 66 | CREATE TRIGGER tr_sync_ll_logbook_set_the_geom_settingstart BEFORE INSERT OR UPDATE OF settingStartLatitude, settingStartLongitude ON ll_logbook.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_settingStart();
|
| 67 | -UPDATE ll_logbook.set SET the_geom_settingstart = ST_SetSRID(ST_MakePoint(settingStartLongitude, settingStartLatitude), 4326) WHERE settingStartLongitude IS NOT NULL AND settingStartLatitude IS NOT NULL AND the_geom_settingstart IS NULL;
|
|
| 67 | +UPDATE ll_logbook.set SET the_geom_settingstart = ST_SetSRID(ST_MakePoint(settingStartLongitude::double precision, settingStartLatitude::double precision), 4326) WHERE settingStartLongitude IS NOT NULL AND settingStartLatitude IS NOT NULL AND the_geom_settingstart IS NULL;
|
|
| 68 | 68 | |
| 69 | -SELECT AddGeometryColumn('ll_logbook', 'set', 'the_geom_settingend', 4326, 'POINT', 2);
|
|
| 69 | +ALTER TABLE ll_logbook.set ADD COLUMN the_geom_settingend geometry(Point, 4326);
|
|
| 70 | 70 | CREATE INDEX IF NOT EXISTS idx_ll_logbook_set_gist_settingend ON ll_logbook.set USING GIST (the_geom_settingend);
|
| 71 | 71 | DROP TRIGGER IF EXISTS tr_sync_ll_logbook_set_the_geom_settingend ON ll_logbook.set;
|
| 72 | 72 | CREATE TRIGGER tr_sync_ll_logbook_set_the_geom_settingend BEFORE INSERT OR UPDATE OF settingEndLatitude, settingEndLongitude ON ll_logbook.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_settingEnd();
|
| 73 | -UPDATE ll_logbook.set SET the_geom_settingend = ST_SetSRID(ST_MakePoint(settingEndLongitude, settingEndLatitude), 4326) WHERE settingEndLongitude IS NOT NULL AND settingEndLatitude IS NOT NULL AND the_geom_settingend IS NULL;
|
|
| 73 | +UPDATE ll_logbook.set SET the_geom_settingend = ST_SetSRID(ST_MakePoint(settingEndLongitude::double precision, settingEndLatitude::double precision), 4326) WHERE settingEndLongitude IS NOT NULL AND settingEndLatitude IS NOT NULL AND the_geom_settingend IS NULL;
|
|
| 74 | 74 | |
| 75 | -SELECT AddGeometryColumn('ll_logbook', 'set', 'the_geom_haulingstart', 4326, 'POINT', 2);
|
|
| 75 | +ALTER TABLE ll_logbook.set ADD COLUMN the_geom_haulingstart geometry(Point, 4326);
|
|
| 76 | 76 | CREATE INDEX IF NOT EXISTS idx_ll_logbook_set_gist_haulingstart ON ll_logbook.set USING GIST (the_geom_haulingstart);
|
| 77 | 77 | DROP TRIGGER IF EXISTS tr_sync_ll_logbook_set_the_geom_haulingstart ON ll_logbook.set;
|
| 78 | 78 | CREATE TRIGGER tr_sync_ll_logbook_set_the_geom_haulingstart BEFORE INSERT OR UPDATE OF haulingStartLatitude, haulingStartLongitude ON ll_logbook.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_haulingStart();
|
| 79 | -UPDATE ll_logbook.set SET the_geom_haulingstart = ST_SetSRID(ST_MakePoint(haulingStartLongitude, haulingStartLatitude), 4326) WHERE haulingStartLongitude IS NOT NULL AND haulingStartLatitude IS NOT NULL AND the_geom_haulingstart IS NULL;
|
|
| 79 | +UPDATE ll_logbook.set SET the_geom_haulingstart = ST_SetSRID(ST_MakePoint(haulingStartLongitude::double precision, haulingStartLatitude::double precision), 4326) WHERE haulingStartLongitude IS NOT NULL AND haulingStartLatitude IS NOT NULL AND the_geom_haulingstart IS NULL;
|
|
| 80 | 80 | |
| 81 | -SELECT AddGeometryColumn('ll_logbook', 'set', 'the_geom_haulingend', 4326, 'POINT', 2);
|
|
| 81 | +ALTER TABLE ll_logbook.set ADD COLUMN the_geom_haulingend geometry(Point, 4326);
|
|
| 82 | 82 | CREATE INDEX IF NOT EXISTS idx_ll_logbook_set_gist_haulingend ON ll_logbook.set USING GIST (the_geom_haulingend);
|
| 83 | 83 | DROP TRIGGER IF EXISTS tr_sync_ll_logbook_set_the_geom_haulingend ON ll_logbook.set;
|
| 84 | 84 | CREATE TRIGGER tr_sync_ll_logbook_set_the_geom_haulingend BEFORE INSERT OR UPDATE OF haulingEndLatitude, haulingEndLongitude ON ll_logbook.set FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_haulingEnd();
|
| 85 | -UPDATE ll_logbook.set SET the_geom_haulingend = ST_SetSRID(ST_MakePoint(haulingEndLongitude, haulingEndLatitude), 4326) WHERE haulingEndLongitude IS NOT NULL AND haulingEndLatitude IS NOT NULL AND the_geom_haulingend IS NULL;
|
|
| 85 | +UPDATE ll_logbook.set SET the_geom_haulingend = ST_SetSRID(ST_MakePoint(haulingEndLongitude::double precision, haulingEndLatitude::double precision), 4326) WHERE haulingEndLongitude IS NOT NULL AND haulingEndLatitude IS NOT NULL AND the_geom_haulingend IS NULL;
|
|
| 86 | 86 | |
| 87 | -SELECT AddGeometryColumn('ll_landing', 'landing', 'the_geom', 4326, 'POINT', 2);
|
|
| 87 | +ALTER TABLE ll_landing.landing ADD COLUMN the_geom geometry(Point, 4326);
|
|
| 88 | 88 | CREATE INDEX IF NOT EXISTS idx_ll_landing_landing_gist ON ll_landing.landing USING GIST (the_geom);
|
| 89 | 89 | DROP TRIGGER IF EXISTS tr_sync_ll_landing_landing_the_geom ON ll_landing.landing;
|
| 90 | 90 | CREATE TRIGGER tr_sync_ll_landing_landing_the_geom BEFORE INSERT OR UPDATE OF latitude, longitude ON ll_landing.landing FOR EACH ROW EXECUTE PROCEDURE sync_the_geom_default();
|
| 91 | -UPDATE ll_landing.landing SET the_geom = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326) AND the_geom IS NULL; |
|
| 91 | +UPDATE ll_landing.landing SET the_geom = ST_SetSRID(ST_MakePoint(longitude::double precision, latitude::double precision), 4326) WHERE latitude IS NOT NULL AND longitude IS NOT NULL AND the_geom IS NULL; |