diff --git a/database/init/001_init_righttree.sql b/database/init/001_init_righttree.sql new file mode 100644 index 0000000..1df3382 --- /dev/null +++ b/database/init/001_init_righttree.sql @@ -0,0 +1,6 @@ +CREATE DATABASE right_tree; + +\c right_tree +CREATE EXTENSION IF NOT EXISTS postgis; +GRANT ALL ON geometry_columns TO PUBLIC; +GRANT ALL ON spatial_ref_sys TO PUBLIC; diff --git a/database/init_database.sh b/database/init_database.sh new file mode 100755 index 0000000..04ad0fe --- /dev/null +++ b/database/init_database.sh @@ -0,0 +1,3 @@ +docker-compose down --remove-orphans --volumes +docker-compose up postgres | sed '/PostgreSQL init process complete; ready for start up./q' +docker-compose down diff --git a/docker-compose.yaml b/docker-compose.yaml index ecf4239..c68f1c0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -38,6 +38,7 @@ services: container_name: postgres volumes: - local-postgres-data:/var/lib/postgresql/data + - ./database/init:/docker-entrypoint-initdb.d ports: - "5432:5432" environment: