feat: add PostGIS extension to dev PostgreSQL
- Add postgis to postgresql_16.withPackages alongside timescaledb - Enable postgis extension on towerops_dev and towerops_test databases
This commit is contained in:
parent
e58767cf00
commit
05970d3649
1 changed files with 9 additions and 3 deletions
|
|
@ -26,8 +26,11 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# PostgreSQL with TimescaleDB extension
|
# PostgreSQL with TimescaleDB and PostGIS extensions
|
||||||
pg = postgresql_16.withPackages (ps: [ ps.timescaledb ]);
|
pg = postgresql_16.withPackages (ps: [
|
||||||
|
ps.timescaledb
|
||||||
|
ps.postgis
|
||||||
|
]);
|
||||||
|
|
||||||
# PostgreSQL data directory (local to project)
|
# PostgreSQL data directory (local to project)
|
||||||
pgDataDir = ".nix-postgres";
|
pgDataDir = ".nix-postgres";
|
||||||
|
|
@ -108,11 +111,14 @@ let
|
||||||
${pg}/bin/createdb -h ${pgHost} -p ${pgPort} -U $USER $db
|
${pg}/bin/createdb -h ${pgHost} -p ${pgPort} -U $USER $db
|
||||||
done
|
done
|
||||||
|
|
||||||
# Enable TimescaleDB extension for dev and test databases
|
# Enable TimescaleDB and PostGIS extensions for dev and test databases
|
||||||
for db in towerops_dev towerops_test; do
|
for db in towerops_dev towerops_test; do
|
||||||
${pg}/bin/psql -h ${pgHost} -p ${pgPort} -U $USER -d $db -c \
|
${pg}/bin/psql -h ${pgHost} -p ${pgPort} -U $USER -d $db -c \
|
||||||
"CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" 2>/dev/null || \
|
"CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" 2>/dev/null || \
|
||||||
echo "⚠️ TimescaleDB not available for $db (optional)"
|
echo "⚠️ TimescaleDB not available for $db (optional)"
|
||||||
|
${pg}/bin/psql -h ${pgHost} -p ${pgPort} -U $USER -d $db -c \
|
||||||
|
"CREATE EXTENSION IF NOT EXISTS postgis CASCADE;" 2>/dev/null || \
|
||||||
|
echo "⚠️ PostGIS not available for $db (optional)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "✓ PostgreSQL started successfully"
|
echo "✓ PostgreSQL started successfully"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue