-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename stops to platforms add stops as a parent for platforms update import script update prisma schema
- Loading branch information
Showing
19 changed files
with
681 additions
and
341 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
59 changes: 59 additions & 0 deletions
59
backend-nest/prisma/migrations/20240929183801_rename_stop_to_platform/migration.sql
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,59 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `Stop` table. If the table is not empty, all the data it contains will be lost. | ||
- You are about to drop the `StopsOnRoutes` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "StopsOnRoutes" DROP CONSTRAINT "StopsOnRoutes_routeId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "StopsOnRoutes" DROP CONSTRAINT "StopsOnRoutes_stopId_fkey"; | ||
|
||
-- DropTable | ||
DROP TABLE "Stop"; | ||
|
||
-- DropTable | ||
DROP TABLE "StopsOnRoutes"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Platform" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"isMetro" BOOLEAN NOT NULL, | ||
"latitude" DOUBLE PRECISION NOT NULL, | ||
"longitude" DOUBLE PRECISION NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Platform_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "PlatformsOnRoutes" ( | ||
"stopId" TEXT NOT NULL, | ||
"routeId" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "PlatformsOnRoutes_pkey" PRIMARY KEY ("stopId","routeId") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Platform_name_idx" ON "Platform"("name"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Platform_latitude_idx" ON "Platform"("latitude"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Platform_longitude_idx" ON "Platform"("longitude"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "Platform_latitude_longitude_idx" ON "Platform"("latitude", "longitude"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlatformsOnRoutes" ADD CONSTRAINT "PlatformsOnRoutes_stopId_fkey" FOREIGN KEY ("stopId") REFERENCES "Platform"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlatformsOnRoutes" ADD CONSTRAINT "PlatformsOnRoutes_routeId_fkey" FOREIGN KEY ("routeId") REFERENCES "Route"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
32 changes: 32 additions & 0 deletions
32
backend-nest/prisma/migrations/20240929184258_add_stop/migration.sql
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,32 @@ | ||
-- DropIndex | ||
DROP INDEX "Platform_latitude_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Platform_latitude_longitude_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Platform_longitude_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Platform_name_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Route_name_idx"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Platform" ADD COLUMN "stopId" TEXT; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Stop" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"avgLatitude" DOUBLE PRECISION NOT NULL, | ||
"avgLongitude" DOUBLE PRECISION NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Stop_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Platform" ADD CONSTRAINT "Platform_stopId_fkey" FOREIGN KEY ("stopId") REFERENCES "Stop"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
22 changes: 22 additions & 0 deletions
22
backend-nest/prisma/migrations/20240929202020_stop_integration/migration.sql
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,22 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `PlatformsOnRoutes` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- You are about to drop the column `stopId` on the `PlatformsOnRoutes` table. All the data in the column will be lost. | ||
- A unique constraint covering the columns `[platformId,routeId]` on the table `PlatformsOnRoutes` will be added. If there are existing duplicate values, this will fail. | ||
- Added the required column `platformId` to the `PlatformsOnRoutes` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "PlatformsOnRoutes" DROP CONSTRAINT "PlatformsOnRoutes_stopId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "PlatformsOnRoutes" DROP CONSTRAINT "PlatformsOnRoutes_pkey", | ||
DROP COLUMN "stopId", | ||
ADD COLUMN "platformId" TEXT NOT NULL; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "PlatformsOnRoutes_platformId_routeId_key" ON "PlatformsOnRoutes"("platformId", "routeId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PlatformsOnRoutes" ADD CONSTRAINT "PlatformsOnRoutes_platformId_fkey" FOREIGN KEY ("platformId") REFERENCES "Platform"("id") ON DELETE RESTRICT 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
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,5 @@ | ||
import { z } from "zod"; | ||
|
||
const METRO_LINES = ["A", "B", "C"] as const; | ||
|
||
export const metroLine = z.enum(METRO_LINES); |
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
Oops, something went wrong.