diff --git a/prisma/migrations/20261116141545_init/migration.sql b/prisma/migrations/20261116141545_init/migration.sql new file mode 100644 index 0000000..152ae72 --- /dev/null +++ b/prisma/migrations/20261116141545_init/migration.sql @@ -0,0 +1,75 @@ +-- CreateTable +CREATE TABLE "Profile" ( + "id" SERIAL NOT NULL, + "firstName" TEXT NOT NULL, + "lastName" TEXT NOT NULL, + "description" TEXT NOT NULL, + + CONSTRAINT "Profile_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Skill" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + "profileId" INTEGER NOT NULL, + + CONSTRAINT "Skill_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Link" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + "link" TEXT NOT NULL, + "profileId" INTEGER NOT NULL, + + CONSTRAINT "Link_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Project" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + "link" TEXT NOT NULL, + "description" TEXT NOT NULL, + "profileId" INTEGER NOT NULL, + + CONSTRAINT "Project_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Experience" ( + "id" SERIAL NOT NULL, + "company" TEXT NOT NULL, + "position" TEXT NOT NULL, + "period" TEXT NOT NULL, + "achievements" TEXT[] DEFAULT ARRAY[]::TEXT[], + "profileId" INTEGER NOT NULL, + + CONSTRAINT "Experience_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE INDEX "Skill_profileId_idx" ON "Skill"("profileId"); + +-- CreateIndex +CREATE INDEX "Link_profileId_idx" ON "Link"("profileId"); + +-- CreateIndex +CREATE INDEX "Project_profileId_idx" ON "Project"("profileId"); + +-- CreateIndex +CREATE INDEX "Experience_profileId_idx" ON "Experience"("profileId"); + +-- AddForeignKey +ALTER TABLE "Skill" ADD CONSTRAINT "Skill_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Link" ADD CONSTRAINT "Link_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Project" ADD CONSTRAINT "Project_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Experience" ADD CONSTRAINT "Experience_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "Profile"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..044d57c --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8bddec1..eab6873 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -11,3 +11,56 @@ generator client { datasource db { provider = "postgresql" } + +model Profile { + id Int @id @default(autoincrement()) + firstName String + lastName String + description String + skills Skill[] + links Link[] + experiences Experience[] + projects Project[] +} + +model Skill { + id Int @id @default(autoincrement()) + name String + profileId Int + profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade) + + @@index([profileId]) +} + +model Link { + id Int @id @default(autoincrement()) + name String + link String + profileId Int + profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade) + + @@index([profileId]) +} + +model Project { + id Int @id @default(autoincrement()) + name String + link String + description String + profileId Int + profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade) + + @@index([profileId]) +} + +model Experience { + id Int @id @default(autoincrement()) + company String + position String + period String + achievements String[] @default([]) + profileId Int + profile Profile @relation(fields: [profileId], references: [id], onDelete: Cascade) + + @@index([profileId]) +}