From 0c1fb5393742e8c7fa44eb2b378e090839660027 Mon Sep 17 00:00:00 2001 From: Pierre-Narcisi Date: Fri, 22 Nov 2024 15:30:41 +0100 Subject: [PATCH 1/2] fix add extension ltree and remove taxhub from build.sh --- assets/postgres/initdb/add-extensions.sql | 27 ++++++++++++++--------- build/build.sh | 2 -- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/assets/postgres/initdb/add-extensions.sql b/assets/postgres/initdb/add-extensions.sql index 7b96a5b..11540f6 100644 --- a/assets/postgres/initdb/add-extensions.sql +++ b/assets/postgres/initdb/add-extensions.sql @@ -1,18 +1,25 @@ CREATE EXTENSION IF NOT EXISTS "hstore"; + CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + CREATE EXTENSION IF NOT EXISTS "pg_trgm"; + CREATE EXTENSION IF NOT EXISTS "unaccent"; +CREATE EXTENSION IF NOT EXISTS "ltree"; CREATE EXTENSION IF NOT EXISTS "postgis"; + -- postgis_raster must be installed separatly only on recent versions of postgis -DO -$$ -BEGIN - IF EXISTS ( - SELECT name FROM PG_CATALOG.PG_AVAILABLE_EXTENSIONS WHERE name = 'postgis_raster' - ) THEN - CREATE EXTENSION IF NOT EXISTS "postgis_raster"; - END IF; -END -$$ +DO $ $ BEGIN IF EXISTS ( + SELECT + name + FROM + PG_CATALOG.PG_AVAILABLE_EXTENSIONS + WHERE + name = 'postgis_raster' +) THEN CREATE EXTENSION IF NOT EXISTS "postgis_raster"; + +END IF; + +END $ $ \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index 530dc8d..cb83398 100755 --- a/build/build.sh +++ b/build/build.sh @@ -29,8 +29,6 @@ docker build \ -f ./build/Dockerfile-geonature-frontend \ -t ${GEONATURE_FRONTEND_EXTRA_IMAGE} . -# TaxHub -docker build -f sources/TaxHub/Dockerfile -t ${TAXHUB_IMAGE} --target=prod sources/TaxHub/ # UsersHub docker build -f sources/UsersHub/Dockerfile -t ${USERSHUB_IMAGE} --target=prod sources/UsersHub/ From e9842f348ab681883cfd0fb8c2d5960e8b1a7012 Mon Sep 17 00:00:00 2001 From: Pierre-Narcisi Date: Fri, 22 Nov 2024 16:31:47 +0100 Subject: [PATCH 2/2] fix add-extensions file --- assets/postgres/initdb/add-extensions.sql | 29 ++++++++++------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/assets/postgres/initdb/add-extensions.sql b/assets/postgres/initdb/add-extensions.sql index 11540f6..f922ca4 100644 --- a/assets/postgres/initdb/add-extensions.sql +++ b/assets/postgres/initdb/add-extensions.sql @@ -1,25 +1,20 @@ CREATE EXTENSION IF NOT EXISTS "hstore"; - CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; - CREATE EXTENSION IF NOT EXISTS "pg_trgm"; - CREATE EXTENSION IF NOT EXISTS "unaccent"; - CREATE EXTENSION IF NOT EXISTS "ltree"; -CREATE EXTENSION IF NOT EXISTS "postgis"; --- postgis_raster must be installed separatly only on recent versions of postgis -DO $ $ BEGIN IF EXISTS ( - SELECT - name - FROM - PG_CATALOG.PG_AVAILABLE_EXTENSIONS - WHERE - name = 'postgis_raster' -) THEN CREATE EXTENSION IF NOT EXISTS "postgis_raster"; - -END IF; -END $ $ \ No newline at end of file +CREATE EXTENSION IF NOT EXISTS "postgis"; +-- postgis_raster must be installed separatly only on recent versions of postgis +DO +$$ +BEGIN + IF EXISTS ( + SELECT name FROM PG_CATALOG.PG_AVAILABLE_EXTENSIONS WHERE name = 'postgis_raster' + ) THEN + CREATE EXTENSION IF NOT EXISTS "postgis_raster"; + END IF; +END +$$