Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

setup prisma for sqlite db

Khuram Niaz94fa5c041962
diff --git a/.gitignore b/.gitignore
index 7e1e047..db0c283 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,10 +27,15 @@ yarn-error.log*
# local env files
.env*.local
-.env
+*.env*
+
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
+
+# prisma sqlite database
+dev.db
+dev.db-journal
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 9057c18..1f71692 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
"name": "jobsync",
"version": "0.1.0",
"dependencies": {
+ "@prisma/client": "^5.14.0",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
@@ -31,6 +32,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.3",
"postcss": "^8",
+ "prisma": "^5.14.0",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
@@ -454,6 +456,68 @@
"node": ">=14"
}
},
+ "node_modules/@prisma/client": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.14.0.tgz",
+ "integrity": "sha512-akMSuyvLKeoU4LeyBAUdThP/uhVP3GuLygFE3MlYzaCb3/J8SfsYBE5PkaFuLuVpLyA6sFoW+16z/aPhNAESqg==",
+ "hasInstallScript": true,
+ "engines": {
+ "node": ">=16.13"
+ },
+ "peerDependencies": {
+ "prisma": "*"
+ },
+ "peerDependenciesMeta": {
+ "prisma": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@prisma/debug": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz",
+ "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==",
+ "devOptional": true
+ },
+ "node_modules/@prisma/engines": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.14.0.tgz",
+ "integrity": "sha512-lgxkKZ6IEygVcw6IZZUlPIfLQ9hjSYAtHjZ5r64sCLDgVzsPFCi2XBBJgzPMkOQ5RHzUD4E/dVdpn9+ez8tk1A==",
+ "devOptional": true,
+ "hasInstallScript": true,
+ "dependencies": {
+ "@prisma/debug": "5.14.0",
+ "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "@prisma/fetch-engine": "5.14.0",
+ "@prisma/get-platform": "5.14.0"
+ }
+ },
+ "node_modules/@prisma/engines-version": {
+ "version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48.tgz",
+ "integrity": "sha512-ip6pNkRo1UxWv+6toxNcYvItNYaqQjXdFNGJ+Nuk2eYtRoEdoF13wxo7/jsClJFFenMPVNVqXQDV0oveXnR1cA==",
+ "devOptional": true
+ },
+ "node_modules/@prisma/fetch-engine": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.14.0.tgz",
+ "integrity": "sha512-VrheA9y9DMURK5vu8OJoOgQpxOhas3qF0IBHJ8G/0X44k82kc8E0w98HCn2nhnbOOMwbWsJWXfLC2/F8n5u0gQ==",
+ "devOptional": true,
+ "dependencies": {
+ "@prisma/debug": "5.14.0",
+ "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "@prisma/get-platform": "5.14.0"
+ }
+ },
+ "node_modules/@prisma/get-platform": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.14.0.tgz",
+ "integrity": "sha512-/yAyBvcEjRv41ynZrhdrPtHgk47xLRRq/o5eWGcUpBJ1YrUZTYB8EoPiopnP7iQrMATK8stXQdPOoVlrzuTQZw==",
+ "devOptional": true,
+ "dependencies": {
+ "@prisma/debug": "5.14.0"
+ }
+ },
"node_modules/@radix-ui/primitive": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.0.1.tgz",
@@ -4381,6 +4445,22 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/prisma": {
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.14.0.tgz",
+ "integrity": "sha512-gCNZco7y5XtjrnQYeDJTiVZmT/ncqCr5RY1/Cf8X2wgLRmyh9ayPAGBNziI4qEE4S6SxCH5omQLVo9lmURaJ/Q==",
+ "devOptional": true,
+ "hasInstallScript": true,
+ "dependencies": {
+ "@prisma/engines": "5.14.0"
+ },
+ "bin": {
+ "prisma": "build/index.js"
+ },
+ "engines": {
+ "node": ">=16.13"
+ }
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
diff --git a/package.json b/package.json
index ca9ae5c..0f2e513 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
+ "@prisma/client": "^5.14.0",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
@@ -32,6 +33,7 @@
"eslint": "^8",
"eslint-config-next": "14.2.3",
"postcss": "^8",
+ "prisma": "^5.14.0",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
diff --git a/prisma/migrations/20240524022540_init/migration.sql b/prisma/migrations/20240524022540_init/migration.sql
new file mode 100644
index 0000000..23d8188
--- /dev/null
+++ b/prisma/migrations/20240524022540_init/migration.sql
@@ -0,0 +1,94 @@
+-- CreateTable
+CREATE TABLE "User" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "name" TEXT NOT NULL,
+ "email" TEXT NOT NULL,
+ "password" TEXT NOT NULL,
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+-- CreateTable
+CREATE TABLE "Contact" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "name" TEXT NOT NULL,
+ "email" TEXT NOT NULL,
+ "interviewId" INTEGER,
+ CONSTRAINT "Contact_interviewId_fkey" FOREIGN KEY ("interviewId") REFERENCES "Interview" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "JobTitle" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "title" TEXT NOT NULL
+);
+
+-- CreateTable
+CREATE TABLE "JobStatus" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "statusName" TEXT NOT NULL
+);
+
+-- CreateTable
+CREATE TABLE "Location" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "name" TEXT NOT NULL,
+ "state" TEXT,
+ "country" TEXT NOT NULL
+);
+
+-- CreateTable
+CREATE TABLE "Company" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "name" TEXT NOT NULL,
+ "logoUrl" TEXT
+);
+
+-- CreateTable
+CREATE TABLE "JobSource" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "name" TEXT NOT NULL
+);
+
+-- CreateTable
+CREATE TABLE "Interview" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "jobId" INTEGER NOT NULL,
+ CONSTRAINT "Interview_jobId_fkey" FOREIGN KEY ("jobId") REFERENCES "Job" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
+);
+
+-- CreateTable
+CREATE TABLE "Job" (
+ "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ "userId" INTEGER NOT NULL,
+ "description" TEXT NOT NULL,
+ "createdAt" DATETIME NOT NULL,
+ "appliedDate" DATETIME,
+ "dueDate" DATETIME,
+ "statusId" INTEGER NOT NULL,
+ "jobTitleId" INTEGER NOT NULL,
+ "companyId" INTEGER NOT NULL,
+ "jobSourceId" INTEGER,
+ "salaryRange" TEXT,
+ "locationId" INTEGER,
+ CONSTRAINT "Job_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "Job_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "JobStatus" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "Job_jobTitleId_fkey" FOREIGN KEY ("jobTitleId") REFERENCES "JobTitle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "Job_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "Company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
+ CONSTRAINT "Job_jobSourceId_fkey" FOREIGN KEY ("jobSourceId") REFERENCES "JobSource" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT "Job_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "Location" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "JobTitle_title_key" ON "JobTitle"("title");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "JobStatus_statusName_key" ON "JobStatus"("statusName");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Location_name_key" ON "Location"("name");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "Company_name_key" ON "Company"("name");
diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml
new file mode 100644
index 0000000..e5e5c47
--- /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 (i.e. Git)
+provider = "sqlite"
\ No newline at end of file
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
new file mode 100644
index 0000000..0f4941d
--- /dev/null
+++ b/prisma/schema.prisma
@@ -0,0 +1,90 @@
+// This is your Prisma schema file,
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
+
+generator client {
+ provider = "prisma-client-js"
+}
+
+datasource db {
+ provider = "sqlite"
+ url = env("DATABASE_URL")
+}
+
+model User {
+ id Int @id @default(autoincrement())
+ name String
+ email String @unique
+ password String
+ createdAt DateTime @default(now())
+ jobsApplied Job[]
+}
+
+model Contact {
+ id Int @id @default(autoincrement())
+ name String
+ email String
+ Interview Interview? @relation(fields: [interviewId], references: [id])
+ interviewId Int?
+}
+
+model JobTitle {
+ id Int @id @default(autoincrement())
+ title String @unique
+ jobs Job[]
+}
+
+model JobStatus {
+ id Int @id @default(autoincrement())
+ statusName String @unique
+ jobs Job[]
+}
+
+model Location {
+ id Int @id @default(autoincrement())
+ name String @unique
+ state String?
+ country String
+ jobsApplied Job[]
+}
+
+model Company {
+ id Int @id @default(autoincrement())
+ name String @unique
+ jobsApplied Job[]
+ logoUrl String? // field is optional
+}
+
+model JobSource {
+ id Int @id @default(autoincrement())
+ name String
+ jobsApplied Job[]
+}
+
+model Interview {
+ id Int @id @default(autoincrement())
+ jobId Int
+ job Job? @relation(fields: [jobId], references: [id])
+ interviewers Contact[]
+}
+
+model Job {
+ id Int @id @default(autoincrement())
+ userId Int
+ User User @relation(fields: [userId], references: [id])
+ description String
+ createdAt DateTime
+ appliedDate DateTime?
+ dueDate DateTime?
+ statusId Int
+ Status JobStatus @relation(fields: [statusId], references: [id])
+ JobTitle JobTitle @relation(fields: [jobTitleId], references: [id])
+ jobTitleId Int
+ Company Company @relation(fields: [companyId], references: [id])
+ companyId Int
+ JobSource JobSource? @relation(fields: [jobSourceId], references: [id])
+ jobSourceId Int?
+ salaryRange String?
+ Location Location? @relation(fields: [locationId], references: [id])
+ locationId Int?
+ Interview Interview[]
+}