-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bacb6ce
commit 4bdda7d
Showing
8 changed files
with
132 additions
and
153 deletions.
There are no files selected for viewing
26 changes: 0 additions & 26 deletions
26
prisma/migrations/20230812173406_added_users_table/migration.sql
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
prisma/migrations/20230817130626_added_project_and_project_access_mapping/migration.sql
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
prisma/migrations/20230909123009_create_forms_tables/migration.sql
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
prisma/migrations/20230909130419_added_unique_form_slug/migration.sql
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
prisma/migrations/20231008073028_add_custom_subdomain_to_project/migration.sql
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
prisma/migrations/20231008135244_added_approve_tags_to_forms/migration.sql
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
prisma/migrations/20231008144348_added_form_response_table/migration.sql
This file was deleted.
Oops, something went wrong.
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,132 @@ | ||
-- CreateEnum | ||
CREATE TYPE "AuthenticationType" AS ENUM ('EMAIL_PASSWORD', 'GOOGLE'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "UserRole" AS ENUM ('ADMIN', 'USER'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "ProjectAccessRole" AS ENUM ('OWNER', 'ADMIN'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "users" ( | ||
"id" TEXT NOT NULL, | ||
"first_name" TEXT NOT NULL, | ||
"last_name" TEXT, | ||
"email" TEXT NOT NULL, | ||
"email_verified" BOOLEAN NOT NULL DEFAULT false, | ||
"password" TEXT, | ||
"salt" TEXT, | ||
"authentication_type" "AuthenticationType" NOT NULL, | ||
"profileImageURL" TEXT, | ||
"role" "UserRole" NOT NULL DEFAULT 'USER', | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "users_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "projects" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"subdomain" TEXT NOT NULL, | ||
"custom_domain" TEXT, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "projects_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "project_access_mapping" ( | ||
"project_id" TEXT NOT NULL, | ||
"user_id" TEXT NOT NULL, | ||
"role" "ProjectAccessRole" NOT NULL DEFAULT 'OWNER' | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "forms" ( | ||
"id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"slug" TEXT NOT NULL, | ||
"intro_title" TEXT NOT NULL, | ||
"intro_message" TEXT, | ||
"prompt_title" TEXT NOT NULL, | ||
"prompt_description" TEXT, | ||
"thankyou_title" TEXT NOT NULL, | ||
"thankyou_message" TEXT, | ||
"enable_cta" BOOLEAN NOT NULL DEFAULT false, | ||
"cta_title" TEXT, | ||
"cta_url" TEXT, | ||
"project_id" TEXT NOT NULL, | ||
"created_by" TEXT NOT NULL, | ||
"is_active" BOOLEAN NOT NULL DEFAULT true, | ||
"primary_color_hex_code" TEXT NOT NULL DEFAULT '#6701E6', | ||
"background_color_hex_code" TEXT NOT NULL DEFAULT '#FFFFFF', | ||
"lang" TEXT NOT NULL DEFAULT 'en', | ||
"collect_video_testimonials" BOOLEAN NOT NULL DEFAULT false, | ||
"collect_text_testimonials" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_ratings" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_images" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_email" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_job_title" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_user_image" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_website_url" BOOLEAN NOT NULL DEFAULT true, | ||
"collect_company" BOOLEAN NOT NULL DEFAULT true, | ||
"auto_approve_testimonials" BOOLEAN NOT NULL DEFAULT false, | ||
"auto_add_tags" TEXT[] DEFAULT ARRAY[]::TEXT[], | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "forms_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "form_responses" ( | ||
"id" TEXT NOT NULL, | ||
"form_id" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT, | ||
"image_url" TEXT, | ||
"rating" INTEGER, | ||
"testimonial" TEXT NOT NULL, | ||
"job_title" TEXT, | ||
"website_url" TEXT, | ||
"company" TEXT, | ||
"tags" TEXT[] DEFAULT ARRAY[]::TEXT[], | ||
"approved" BOOLEAN NOT NULL DEFAULT false, | ||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updated_at" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "form_responses_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "users_email_key" ON "users"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "projects_subdomain_key" ON "projects"("subdomain"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "projects_custom_domain_key" ON "projects"("custom_domain"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "project_access_mapping_project_id_user_id_key" ON "project_access_mapping"("project_id", "user_id"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "forms_slug_project_id_key" ON "forms"("slug", "project_id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "project_access_mapping" ADD CONSTRAINT "project_access_mapping_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "project_access_mapping" ADD CONSTRAINT "project_access_mapping_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "forms" ADD CONSTRAINT "forms_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "forms" ADD CONSTRAINT "forms_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "form_responses" ADD CONSTRAINT "form_responses_form_id_fkey" FOREIGN KEY ("form_id") REFERENCES "forms"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |