forked from code100x/job-board
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync constants with db enums code100x#289 (code100x#299)
* sync-db * contants-db-sync * keys-fix * key --------- Co-authored-by: Aakash Singh <[email protected]>
- Loading branch information
1 parent
a3c7c9c
commit bf2055e
Showing
9 changed files
with
138 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Currency" AS ENUM ('INR', 'USD'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "WorkMode" AS ENUM ('remote', 'hybrid', 'office'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "Role" AS ENUM ('USER', 'ADMIN'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "Location" AS ENUM ('BANGLORE', 'DELHI', 'MUMBAI', 'PUNE', 'CHENNAI', 'HYDERABAD', 'KOLKATA', 'AHMEDABAD', 'JAIPUR', 'SURAT'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"password" TEXT NOT NULL, | ||
"avatar" TEXT, | ||
"isVerified" BOOLEAN NOT NULL DEFAULT false, | ||
"role" "Role" NOT NULL DEFAULT 'USER', | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Job" ( | ||
"id" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"description" TEXT, | ||
"company_name" TEXT NOT NULL, | ||
"work_mode" "WorkMode" NOT NULL, | ||
"currency" "Currency" NOT NULL DEFAULT 'INR', | ||
"location" "Location" NOT NULL, | ||
"has_salary_range" BOOLEAN NOT NULL DEFAULT false, | ||
"minSalary" INTEGER, | ||
"maxSalary" INTEGER, | ||
"is_verified_job" BOOLEAN NOT NULL DEFAULT false, | ||
"postedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Job_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Job" ADD CONSTRAINT "Job_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Warnings: | ||
- Changed the type of `location` on the `Job` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
*/ | ||
-- CreateEnum | ||
CREATE TYPE "JobLocations" AS ENUM ('BANGLORE', 'DELHI', 'MUMBAI', 'PUNE', 'CHENNAI', 'HYDERABAD', 'KOLKATA', 'AHMEDABAD', 'JAIPUR', 'SURAT'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "Job" DROP COLUMN "location", | ||
ADD COLUMN "location" "JobLocations" NOT NULL; | ||
|
||
-- DropEnum | ||
DROP TYPE "Location"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.