Skip to content

Commit

Permalink
feat(shema): define snake_case naming strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam-sharma7 committed Nov 1, 2024
1 parent 6780f2f commit 2a946cd
Show file tree
Hide file tree
Showing 8 changed files with 502 additions and 37 deletions.
1 change: 1 addition & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export default {
database: process.env.NUXT_DB_DATABASE!,
ssl: false,
},
casing: 'snake_case',
} satisfies Config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@vee-validate/zod": "^4.13.1",
"@vueuse/core": "^11.1.0",
"class-variance-authority": "^0.7.0",
"drizzle-kit": "^0.24.2",
"drizzle-orm": "^0.33.0",
"drizzle-kit": "^0.25.0",
"drizzle-orm": "^0.34.0",
"jsonwebtoken": "^9.0.2",
"jwks-rsa": "^3.1.0",
"nuxt": "^3.13.2",
Expand Down
34 changes: 34 additions & 0 deletions server/db/migrations/0012_strong_cannonball.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ALTER TABLE "job_postings" DROP CONSTRAINT "job_postings_owner_id_users_id_fk";
--> statement-breakpoint
ALTER TABLE "posting_applicants" DROP CONSTRAINT "posting_applicants_owner_id_users_id_fk";
--> statement-breakpoint
ALTER TABLE "posting_applicants" DROP CONSTRAINT "posting_applicants_job_id_job_postings_id_fk";
--> statement-breakpoint
ALTER TABLE "job_postings" ADD COLUMN "owner" uuid;--> statement-breakpoint
ALTER TABLE "posting_applicants" ADD COLUMN "candidate_id" uuid NOT NULL;--> statement-breakpoint
ALTER TABLE "posting_applicants" ADD COLUMN "posting_id" uuid NOT NULL;--> statement-breakpoint
ALTER TABLE "posting_applicants" ADD COLUMN "status" integer DEFAULT -1;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "top5_skills_csv" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "job_postings" ADD CONSTRAINT "job_postings_owner_users_id_fk" FOREIGN KEY ("owner") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "posting_applicants" ADD CONSTRAINT "posting_applicants_candidate_id_users_id_fk" FOREIGN KEY ("candidate_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "posting_applicants" ADD CONSTRAINT "posting_applicants_posting_id_job_postings_id_fk" FOREIGN KEY ("posting_id") REFERENCES "public"."job_postings"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "job_postings" DROP COLUMN IF EXISTS "owner_id";--> statement-breakpoint
ALTER TABLE "posting_applicants" DROP COLUMN IF EXISTS "owner_id";--> statement-breakpoint
ALTER TABLE "posting_applicants" DROP COLUMN IF EXISTS "job_id";--> statement-breakpoint
ALTER TABLE "posting_applicants" DROP COLUMN IF EXISTS "status_id";--> statement-breakpoint
ALTER TABLE "users" DROP COLUMN IF EXISTS "top_5_skills_csv";
Loading

0 comments on commit 2a946cd

Please sign in to comment.