ts ki mkc

This commit is contained in:
Om Lanke
2025-07-04 23:08:09 +05:30
parent 57e25f663b
commit 8acc3e6955
19 changed files with 1691 additions and 102 deletions

View File

@@ -1,5 +1,6 @@
import { drizzle } from 'drizzle-orm/neon-http';
import * as schema from './schema.ts';
export const db = drizzle(process.env.DATABASE_URL!);
export const db = drizzle(process.env.DATABASE_URL!, { schema });
export * from './schema.ts';
export * from './schema.ts';

View File

@@ -0,0 +1,30 @@
ALTER TABLE "applications" RENAME COLUMN "job_id" TO "jobId";--> statement-breakpoint
ALTER TABLE "applications" RENAME COLUMN "student_id" TO "studentId";--> statement-breakpoint
ALTER TABLE "applications" RENAME COLUMN "resume_id" TO "resumeId";--> statement-breakpoint
ALTER TABLE "grades" RENAME COLUMN "student_id" TO "studentId";--> statement-breakpoint
ALTER TABLE "internships" RENAME COLUMN "student_id" TO "studentId";--> statement-breakpoint
ALTER TABLE "jobs" RENAME COLUMN "company_id" TO "companyId";--> statement-breakpoint
ALTER TABLE "resumes" RENAME COLUMN "student_id" TO "studentId";--> statement-breakpoint
ALTER TABLE "applications" DROP CONSTRAINT "applications_job_id_jobs_id_fk";
--> statement-breakpoint
ALTER TABLE "applications" DROP CONSTRAINT "applications_student_id_students_id_fk";
--> statement-breakpoint
ALTER TABLE "applications" DROP CONSTRAINT "applications_resume_id_resumes_id_fk";
--> statement-breakpoint
ALTER TABLE "grades" DROP CONSTRAINT "grades_student_id_students_id_fk";
--> statement-breakpoint
ALTER TABLE "internships" DROP CONSTRAINT "internships_student_id_students_id_fk";
--> statement-breakpoint
ALTER TABLE "jobs" DROP CONSTRAINT "jobs_company_id_companies_id_fk";
--> statement-breakpoint
ALTER TABLE "resumes" DROP CONSTRAINT "resumes_student_id_students_id_fk";
--> statement-breakpoint
ALTER TABLE "grades" DROP CONSTRAINT "grades_student_id_sem_pk";--> statement-breakpoint
ALTER TABLE "grades" ADD CONSTRAINT "grades_studentId_sem_pk" PRIMARY KEY("studentId","sem");--> statement-breakpoint
ALTER TABLE "applications" ADD CONSTRAINT "applications_jobId_jobs_id_fk" FOREIGN KEY ("jobId") REFERENCES "public"."jobs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "applications" ADD CONSTRAINT "applications_studentId_students_id_fk" FOREIGN KEY ("studentId") REFERENCES "public"."students"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "applications" ADD CONSTRAINT "applications_resumeId_resumes_id_fk" FOREIGN KEY ("resumeId") REFERENCES "public"."resumes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "grades" ADD CONSTRAINT "grades_studentId_students_id_fk" FOREIGN KEY ("studentId") REFERENCES "public"."students"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "internships" ADD CONSTRAINT "internships_studentId_students_id_fk" FOREIGN KEY ("studentId") REFERENCES "public"."students"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "jobs" ADD CONSTRAINT "jobs_companyId_companies_id_fk" FOREIGN KEY ("companyId") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "resumes" ADD CONSTRAINT "resumes_studentId_students_id_fk" FOREIGN KEY ("studentId") REFERENCES "public"."students"("id") ON DELETE no action ON UPDATE no action;

View File

@@ -0,0 +1,769 @@
{
"id": "9394fab4-d946-45ac-ac5a-2fc22cf46a07",
"prevId": "1506d00a-2620-44ac-af01-19e04c21f679",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.admins": {
"name": "admins",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"admins_email_unique": {
"name": "admins_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.applications": {
"name": "applications",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"jobId": {
"name": "jobId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"studentId": {
"name": "studentId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"resumeId": {
"name": "resumeId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"applications_jobId_jobs_id_fk": {
"name": "applications_jobId_jobs_id_fk",
"tableFrom": "applications",
"tableTo": "jobs",
"columnsFrom": [
"jobId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"applications_studentId_students_id_fk": {
"name": "applications_studentId_students_id_fk",
"tableFrom": "applications",
"tableTo": "students",
"columnsFrom": [
"studentId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"applications_resumeId_resumes_id_fk": {
"name": "applications_resumeId_resumes_id_fk",
"tableFrom": "applications",
"tableTo": "resumes",
"columnsFrom": [
"resumeId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.companies": {
"name": "companies",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"link": {
"name": "link",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"imageURL": {
"name": "imageURL",
"type": "text",
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.grades": {
"name": "grades",
"schema": "",
"columns": {
"studentId": {
"name": "studentId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sem": {
"name": "sem",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"sgpi": {
"name": "sgpi",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": true
},
"isKT": {
"name": "isKT",
"type": "boolean",
"primaryKey": false,
"notNull": true
},
"deadKT": {
"name": "deadKT",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"grades_studentId_students_id_fk": {
"name": "grades_studentId_students_id_fk",
"tableFrom": "grades",
"tableTo": "students",
"columnsFrom": [
"studentId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"grades_studentId_sem_pk": {
"name": "grades_studentId_sem_pk",
"columns": [
"studentId",
"sem"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {
"sem_check1": {
"name": "sem_check1",
"value": "\"grades\".\"sem\" < 9"
}
},
"isRLSEnabled": false
},
"public.internships": {
"name": "internships",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"studentId": {
"name": "studentId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"company": {
"name": "company",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": true
},
"startDate": {
"name": "startDate",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"endDate": {
"name": "endDate",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"internships_studentId_students_id_fk": {
"name": "internships_studentId_students_id_fk",
"tableFrom": "internships",
"tableTo": "students",
"columnsFrom": [
"studentId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.jobs": {
"name": "jobs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"companyId": {
"name": "companyId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"link": {
"name": "link",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": true
},
"imageURL": {
"name": "imageURL",
"type": "text",
"primaryKey": false,
"notNull": true
},
"salary": {
"name": "salary",
"type": "text",
"primaryKey": false,
"notNull": true
},
"applicationDeadline": {
"name": "applicationDeadline",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"minCGPA": {
"name": "minCGPA",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"minSSC": {
"name": "minSSC",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"minHSC": {
"name": "minHSC",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"allowDeadKT": {
"name": "allowDeadKT",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"allowLiveKT": {
"name": "allowLiveKT",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"jobs_companyId_companies_id_fk": {
"name": "jobs_companyId_companies_id_fk",
"tableFrom": "jobs",
"tableTo": "companies",
"columnsFrom": [
"companyId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.resumes": {
"name": "resumes",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"studentId": {
"name": "studentId",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true
},
"link": {
"name": "link",
"type": "text",
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"resumes_studentId_students_id_fk": {
"name": "resumes_studentId_students_id_fk",
"tableFrom": "resumes",
"tableTo": "students",
"columnsFrom": [
"studentId"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.students": {
"name": "students",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"rollNumber": {
"name": "rollNumber",
"type": "varchar(12)",
"primaryKey": false,
"notNull": false
},
"verified": {
"name": "verified",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"firstName": {
"name": "firstName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"middleName": {
"name": "middleName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"lastName": {
"name": "lastName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"mothersName": {
"name": "mothersName",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"gender": {
"name": "gender",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"dob": {
"name": "dob",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"personalGmail": {
"name": "personalGmail",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phoneNumber": {
"name": "phoneNumber",
"type": "varchar(10)",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"profilePicture": {
"name": "profilePicture",
"type": "text",
"primaryKey": false,
"notNull": false
},
"degree": {
"name": "degree",
"type": "text",
"primaryKey": false,
"notNull": false
},
"branch": {
"name": "branch",
"type": "text",
"primaryKey": false,
"notNull": false
},
"year": {
"name": "year",
"type": "text",
"primaryKey": false,
"notNull": false
},
"skills": {
"name": "skills",
"type": "text[]",
"primaryKey": false,
"notNull": false,
"default": "ARRAY[]::text[]"
},
"linkedin": {
"name": "linkedin",
"type": "text",
"primaryKey": false,
"notNull": false
},
"github": {
"name": "github",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ssc": {
"name": "ssc",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": false
},
"hsc": {
"name": "hsc",
"type": "numeric(4, 2)",
"primaryKey": false,
"notNull": false
},
"isDiploma": {
"name": "isDiploma",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View File

@@ -43,6 +43,13 @@
"when": 1751182452704,
"tag": "0005_solid_photon",
"breakpoints": true
},
{
"idx": 6,
"version": "7",
"when": 1751619273079,
"tag": "0006_mysterious_lionheart",
"breakpoints": true
}
]
}
}

View File

@@ -12,7 +12,7 @@ import {
check,
} from 'drizzle-orm/pg-core';
export { createSelectSchema } from 'drizzle-zod';
export { createSelectSchema, createInsertSchema } from 'drizzle-zod';
export const students = pgTable('students', {
id: serial().primaryKey(),
@@ -49,7 +49,7 @@ export const students = pgTable('students', {
export const internships = pgTable('internships', {
id: serial().primaryKey(),
studentId: integer('student_id')
studentId: integer()
.notNull()
.references(() => students.id),
title: text().notNull(),
@@ -101,7 +101,7 @@ export const internships = pgTable('internships', {
export const resumes = pgTable('resumes', {
id: serial().primaryKey(),
studentId: integer('student_id')
studentId: integer()
.notNull()
.references(() => students.id),
title: text().notNull(),
@@ -116,7 +116,7 @@ export const resumes = pgTable('resumes', {
export const grades = pgTable(
'grades',
{
studentId: integer('student_id')
studentId: integer()
.notNull()
.references(() => students.id),
sem: integer().notNull(),
@@ -196,7 +196,7 @@ export const companies = pgTable('companies', {
export const jobs = pgTable('jobs', {
id: serial().primaryKey(),
companyId: integer('company_id')
companyId: integer()
.notNull()
.references(() => companies.id),
title: text().notNull(),
@@ -221,13 +221,13 @@ export const jobs = pgTable('jobs', {
export const applications = pgTable('applications', {
id: serial().primaryKey(),
jobId: integer('job_id')
jobId: integer()
.notNull()
.references(() => jobs.id),
studentId: integer('student_id')
studentId: integer()
.notNull()
.references(() => students.id),
resumeId: integer('resume_id')
resumeId: integer()
.notNull()
.references(() => resumes.id),
status: text().notNull().default('pending'),