territory/prisma/migrations/20230206113946_init/migration.sql

22 lines
675 B
MySQL
Raw Normal View History

2023-02-06 12:50:07 +00:00
-- CreateExtension
CREATE EXTENSION IF NOT EXISTS "postgis";
2023-03-20 09:23:59 +00:00
-- Required to use postgis extension :
-- set the search_path to both public (where is postgis) AND the current schema
SET search_path TO territory, public;
2023-02-06 12:50:07 +00:00
-- CreateTable
CREATE TABLE "territory" (
"uuid" UUID NOT NULL,
"name" TEXT NOT NULL,
"shape" geometry NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
2023-02-08 11:19:52 +00:00
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
2023-02-06 12:50:07 +00:00
CONSTRAINT "territory_pkey" PRIMARY KEY ("uuid")
);
-- CreateIndex
2023-02-07 13:06:24 +00:00
CREATE UNIQUE INDEX "territory_name_key" ON "territory"("name");
2023-02-06 12:50:07 +00:00
CREATE INDEX "shape_idx" ON "territory" USING GIST ("shape");