checkpoint
This commit is contained in:
parent
24281a6322
commit
5dc89497c6
16 changed files with 1427 additions and 15 deletions
93
backend/prisma/migrations/0_init/migration.sql
Normal file
93
backend/prisma/migrations/0_init/migration.sql
Normal file
|
@ -0,0 +1,93 @@
|
|||
-- CreateSchema
|
||||
CREATE SCHEMA IF NOT EXISTS "public";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."ingredients" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"type" VARCHAR(255),
|
||||
"notes" VARCHAR(255),
|
||||
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ingredients_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."knex_migrations" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" VARCHAR(255),
|
||||
"batch" INTEGER,
|
||||
"migration_time" TIMESTAMPTZ(6),
|
||||
|
||||
CONSTRAINT "knex_migrations_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."knex_migrations_lock" (
|
||||
"index" SERIAL NOT NULL,
|
||||
"is_locked" INTEGER,
|
||||
|
||||
CONSTRAINT "knex_migrations_lock_pkey" PRIMARY KEY ("index")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."recipe_ingredients" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"recipe_id" INTEGER NOT NULL,
|
||||
"ingredient_id" INTEGER,
|
||||
"quantity" VARCHAR(255),
|
||||
"unit" VARCHAR(255),
|
||||
"notes" VARCHAR(255),
|
||||
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"raw" VARCHAR(255) DEFAULT '',
|
||||
|
||||
CONSTRAINT "recipe_ingredients_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."recipe_steps" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"recipe_id" INTEGER,
|
||||
"step_number" INTEGER,
|
||||
"instruction" VARCHAR(510),
|
||||
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "recipe_steps_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "public"."recipes" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"cuisine" VARCHAR(255) NOT NULL,
|
||||
"created_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"author" VARCHAR(255),
|
||||
"stars" INTEGER,
|
||||
"prep_minutes" INTEGER,
|
||||
"cook_minutes" INTEGER,
|
||||
|
||||
CONSTRAINT "recipes_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ingredients_name_unique" ON "public"."ingredients"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "recipe_ingredients_ingredient_id_index" ON "public"."recipe_ingredients"("ingredient_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "recipe_ingredients_recipe_id_index" ON "public"."recipe_ingredients"("recipe_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "recipe_steps_recipe_id_index" ON "public"."recipe_steps"("recipe_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "recipe_steps_recipe_id_step_number_unique" ON "public"."recipe_steps"("recipe_id", "step_number");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "recipes_name_unique" ON "public"."recipes"("name");
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue