-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add models and ingestion scripts Signed-off-by: 35C4n0r <[email protected]> * feat: improve table schema Signed-off-by: 35C4n0r <[email protected]> * fix: fix migration typo Signed-off-by: 35C4n0r <[email protected]> * ref: refactor db schema Signed-off-by: 35C4n0r <[email protected]> * chore: replace schema Signed-off-by: 35C4n0r <[email protected]> * chore: replace schema Signed-off-by: 35C4n0r <[email protected]> * feat: migrate codebase Signed-off-by: 35C4n0r <[email protected]> * feat: add create/search place APIs * feat: fix setup script --------- Signed-off-by: 35C4n0r <[email protected]> Co-authored-by: 35C4n0r <[email protected]> Co-authored-by: Jay Kumar <[email protected]>
- Loading branch information
1 parent
a679623
commit 5cc60d3
Showing
43 changed files
with
1,513 additions
and
750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DATABASE_URL=postgresql://admin:[email protected]:5555/gis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,6 @@ src/.DS_Store | |
/src/geojson-data/ | ||
/src/geoquery.in.data/ | ||
db.mmdb | ||
|
||
|
||
.env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: "3.9" | ||
|
||
services: | ||
postgis: | ||
container_name: geopostgis | ||
image: postgis/postgis:16-3.4-alpine | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_USER=admin | ||
- POSTGRES_DB=gis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
-- CreateExtension | ||
CREATE EXTENSION IF NOT EXISTS "fuzzystrmatch"; | ||
|
||
-- CreateExtension | ||
CREATE EXTENSION IF NOT EXISTS "postgis"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "State" ( | ||
"id" SERIAL NOT NULL, | ||
"state_code" INTEGER NOT NULL, | ||
"state_name" TEXT NOT NULL, | ||
"metadata" JSONB, | ||
"geometry" geometry NOT NULL, | ||
|
||
CONSTRAINT "State_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "District" ( | ||
"id" SERIAL NOT NULL, | ||
"district_code" INTEGER NOT NULL, | ||
"district_name" TEXT NOT NULL, | ||
"geometry" geometry NOT NULL, | ||
"metadata" JSONB, | ||
"state_id" INTEGER, | ||
|
||
CONSTRAINT "District_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "SubDistrict" ( | ||
"id" SERIAL NOT NULL, | ||
"subdistrict_code" INTEGER NOT NULL, | ||
"subdistrict_name" TEXT NOT NULL, | ||
"geometry" geometry NOT NULL, | ||
"metadata" JSONB, | ||
"district_id" INTEGER, | ||
"state_id" INTEGER, | ||
|
||
CONSTRAINT "SubDistrict_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Village" ( | ||
"id" SERIAL NOT NULL, | ||
"village_code" SERIAL NOT NULL, | ||
"geometry" geometry NOT NULL, | ||
"village_name" TEXT NOT NULL, | ||
"metadata" JSONB, | ||
"subdistrict_id" INTEGER, | ||
"district_id" INTEGER, | ||
"state_id" INTEGER, | ||
|
||
CONSTRAINT "Village_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "State_state_code_key" ON "State"("state_code"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "State_state_name_key" ON "State"("state_name"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "District_district_code_key" ON "District"("district_code"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "SubDistrict_subdistrict_code_key" ON "SubDistrict"("subdistrict_code"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "District" ADD CONSTRAINT "District_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "State"("state_code") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "SubDistrict" ADD CONSTRAINT "SubDistrict_district_id_fkey" FOREIGN KEY ("district_id") REFERENCES "District"("district_code") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "SubDistrict" ADD CONSTRAINT "SubDistrict_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "State"("state_code") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Village" ADD CONSTRAINT "Village_subdistrict_id_fkey" FOREIGN KEY ("subdistrict_id") REFERENCES "SubDistrict"("subdistrict_code") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Village" ADD CONSTRAINT "Village_district_id_fkey" FOREIGN KEY ("district_id") REFERENCES "District"("district_code") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Village" ADD CONSTRAINT "Village_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "State"("state_code") ON DELETE SET NULL ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- CreateTable | ||
CREATE TABLE "Place" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"tag" TEXT NOT NULL, | ||
"location" geometry(Point, 4326) NOT NULL, | ||
|
||
CONSTRAINT "Place_pkey" PRIMARY KEY ("id") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
Oops, something went wrong.