diff --git a/prisma/migrations/20221230042604_initial/migration.sql b/prisma/migrations/20221230042604_initial/migration.sql deleted file mode 100644 index a47f4713..00000000 --- a/prisma/migrations/20221230042604_initial/migration.sql +++ /dev/null @@ -1,62 +0,0 @@ --- CreateTable -CREATE TABLE "user_accounts" ( - "cuid" TEXT NOT NULL, - "email" TEXT NOT NULL, - "user_role" TEXT NOT NULL, - "first_name" TEXT NOT NULL, - "middle_name" TEXT NOT NULL, - "last_name" TEXT NOT NULL, - "phone" TEXT NOT NULL, - - CONSTRAINT "user_accounts_pkey" PRIMARY KEY ("cuid") -); - --- CreateTable -CREATE TABLE "page_details" ( - "cuid" TEXT NOT NULL, - "page_name" TEXT NOT NULL, - "status" TEXT NOT NULL, - "day_of_birth" TIMESTAMP(3) NOT NULL, - "day_of_passing" TIMESTAMP(3) NOT NULL, - "visitation_date" TIMESTAMP(3) NOT NULL, - "visitation_time" TIMESTAMP(3) NOT NULL, - "visitation_location" TEXT NOT NULL, - "visitation_description" TEXT NOT NULL, - "funeral_date" TIMESTAMP(3) NOT NULL, - "funeral_time" TIMESTAMP(3) NOT NULL, - "funeral_location" TEXT NOT NULL, - "funeral_description" TEXT NOT NULL, - "obituary" TEXT NOT NULL, - "images" TEXT[], - "donation_goal" MONEY NOT NULL, - "amount_raised" MONEY NOT NULL, - "deadline" TIMESTAMP(3) NOT NULL, - "family_cuid" TEXT NOT NULL, - - CONSTRAINT "page_details_pkey" PRIMARY KEY ("cuid") -); - --- CreateTable -CREATE TABLE "page_donations" ( - "cuid" TEXT NOT NULL, - "family_cuid" TEXT NOT NULL, - "page_cuid" TEXT NOT NULL, - "page_name" TEXT NOT NULL, - "link" TEXT NOT NULL, - "status" TEXT NOT NULL, - "description" TEXT NOT NULL, - - CONSTRAINT "page_donations_pkey" PRIMARY KEY ("cuid") -); - --- CreateIndex -CREATE UNIQUE INDEX "user_accounts_email_key" ON "user_accounts"("email"); - --- AddForeignKey -ALTER TABLE "page_details" ADD CONSTRAINT "page_details_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "page_details"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20230515012918_spring_2023_final_migration/migration.sql b/prisma/migrations/20230515012918_spring_2023_final_migration/migration.sql deleted file mode 100644 index e4f62326..00000000 --- a/prisma/migrations/20230515012918_spring_2023_final_migration/migration.sql +++ /dev/null @@ -1,83 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `description` on the `page_donations` table. All the data in the column will be lost. - - You are about to drop the column `link` on the `page_donations` table. All the data in the column will be lost. - - You are about to drop the column `page_name` on the `page_donations` table. All the data in the column will be lost. - - You are about to drop the column `status` on the `page_donations` table. All the data in the column will be lost. - - You are about to drop the `page_details` table. If the table is not empty, all the data it contains will be lost. - - A unique constraint covering the columns `[transaction_id]` on the table `page_donations` will be added. If there are existing duplicate values, this will fail. - - Added the required column `amount` to the `page_donations` table without a default value. This is not possible if the table is not empty. - - Added the required column `transaction_id` to the `page_donations` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "page_details" DROP CONSTRAINT "page_details_family_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "page_donations" DROP CONSTRAINT "page_donations_page_cuid_fkey"; - --- AlterTable -ALTER TABLE "page_donations" DROP COLUMN "description", -DROP COLUMN "link", -DROP COLUMN "page_name", -DROP COLUMN "status", -ADD COLUMN "amount" DECIMAL(65,30) NOT NULL, -ADD COLUMN "success" BOOLEAN NOT NULL DEFAULT false, -ADD COLUMN "transaction_id" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "user_accounts" ALTER COLUMN "user_role" SET DEFAULT 'family', -ALTER COLUMN "first_name" SET DEFAULT '', -ALTER COLUMN "middle_name" SET DEFAULT '', -ALTER COLUMN "last_name" SET DEFAULT '', -ALTER COLUMN "phone" SET DEFAULT ''; - --- DropTable -DROP TABLE "page_details"; - --- CreateTable -CREATE TABLE "pages" ( - "cuid" TEXT NOT NULL, - "page_name" TEXT NOT NULL, - "day_of_birth" TEXT NOT NULL, - "day_of_passing" TEXT NOT NULL, - "visitation_date" TEXT NOT NULL, - "visitation_location" TEXT NOT NULL, - "visitation_description" TEXT NOT NULL, - "funeral_date" TEXT NOT NULL, - "funeral_location" TEXT NOT NULL, - "funeral_description" TEXT NOT NULL, - "obituary" TEXT NOT NULL, - "images" TEXT[], - "donation_goal" DECIMAL(65,30) NOT NULL DEFAULT 0, - "amount_raised" DECIMAL(65,30) NOT NULL DEFAULT 0, - "deadline" TEXT NOT NULL, - "family_cuid" TEXT NOT NULL, - - CONSTRAINT "pages_pkey" PRIMARY KEY ("cuid") -); - --- CreateTable -CREATE TABLE "images" ( - "cuid" TEXT NOT NULL, - "url" TEXT NOT NULL, - "pageCuid" TEXT NOT NULL, - - CONSTRAINT "images_pkey" PRIMARY KEY ("cuid") -); - --- CreateIndex -CREATE UNIQUE INDEX "images_pageCuid_url_key" ON "images"("pageCuid", "url"); - --- CreateIndex -CREATE UNIQUE INDEX "page_donations_transaction_id_key" ON "page_donations"("transaction_id"); - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "images" ADD CONSTRAINT "images_pageCuid_fkey" FOREIGN KEY ("pageCuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20230515013326_spring_2023_initial/migration.sql b/prisma/migrations/20230515013326_spring_2023_initial/migration.sql deleted file mode 100644 index 88dbbe32..00000000 --- a/prisma/migrations/20230515013326_spring_2023_initial/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - Added the required column `timezone` to the `pages` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "pages" ADD COLUMN "timezone" TEXT NOT NULL; diff --git a/prisma/migrations/20230525003614_summer2/migration.sql b/prisma/migrations/20230525003614_summer2/migration.sql deleted file mode 100644 index 7f91b437..00000000 --- a/prisma/migrations/20230525003614_summer2/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `timezone` on the `pages` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "pages" DROP COLUMN "timezone"; diff --git a/prisma/migrations/20230706211034_mid_summer_2023/migration.sql b/prisma/migrations/20230706211034_mid_summer_2023/migration.sql deleted file mode 100644 index 2af3fd69..00000000 --- a/prisma/migrations/20230706211034_mid_summer_2023/migration.sql +++ /dev/null @@ -1,58 +0,0 @@ -/* - Warnings: - - You are about to alter the column `amount` on the `page_donations` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - You are about to alter the column `donation_goal` on the `pages` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - You are about to alter the column `amount_raised` on the `pages` table. The data in that column could be lost. The data in that column will be cast from `Decimal(65,30)` to `Integer`. - - Added the required column `profile_image_cuid` to the `pages` table without a default value. This is not possible if the table is not empty. - */ - --- AlterTable - -ALTER TABLE "page_donations" -ALTER COLUMN "amount" -SET DATA TYPE INTEGER; - --- AlterTable - -ALTER TABLE "pages" -ADD - COLUMN "amount_distributed" INTEGER NOT NULL DEFAULT 0, -ADD - COLUMN "profile_image_cuid" TEXT NOT NULL, -ALTER COLUMN "donation_goal" -SET DEFAULT 0, -ALTER COLUMN "donation_goal" -SET DATA TYPE INTEGER, -ALTER COLUMN "amount_raised" -SET DEFAULT 0, -ALTER COLUMN "amount_raised" -SET DATA TYPE INTEGER; - --- CreateTable - -CREATE TABLE - "DonationPayout" ( - "cuid" TEXT NOT NULL, - "family_cuid" TEXT NOT NULL, - "page_cuid" TEXT NOT NULL, - "transaction_id" TEXT NOT NULL, - "amount" INTEGER NOT NULL DEFAULT 0, - "distributionDate" TEXT NOT NULL, - CONSTRAINT "DonationPayout_pkey" PRIMARY KEY ("cuid") - ); - --- CreateIndex - -CREATE UNIQUE INDEX "DonationPayout_transaction_id_key" ON "DonationPayout"("transaction_id"); - --- AddForeignKey - -ALTER TABLE "DonationPayout" -ADD - CONSTRAINT "DonationPayout_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey - -ALTER TABLE "DonationPayout" -ADD - CONSTRAINT "DonationPayout_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; \ No newline at end of file diff --git a/prisma/migrations/20230809201420_/migration.sql b/prisma/migrations/20230809201420_/migration.sql deleted file mode 100644 index ff43fee8..00000000 --- a/prisma/migrations/20230809201420_/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ --- DropForeignKey -ALTER TABLE "images" DROP CONSTRAINT "images_pageCuid_fkey"; - --- DropIndex -DROP INDEX "images_pageCuid_url_key"; - --- AlterTable -ALTER TABLE "images" ALTER COLUMN "pageCuid" DROP NOT NULL; - --- AddForeignKey -ALTER TABLE "images" ADD CONSTRAINT "images_pageCuid_fkey" FOREIGN KEY ("pageCuid") REFERENCES "pages"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20230911214308_f23_start/migration.sql b/prisma/migrations/20230911214308_f23_start/migration.sql deleted file mode 100644 index 465b3683..00000000 --- a/prisma/migrations/20230911214308_f23_start/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE "pages" ALTER COLUMN "visitation_date" DROP NOT NULL, -ALTER COLUMN "funeral_date" DROP NOT NULL; diff --git a/prisma/migrations/20231017180735_sdasd/migration.sql b/prisma/migrations/20231017180735_sdasd/migration.sql deleted file mode 100644 index 2a42dd9c..00000000 --- a/prisma/migrations/20231017180735_sdasd/migration.sql +++ /dev/null @@ -1,41 +0,0 @@ -/* - Warnings: - - - Added the required column `families_cuid` to the `pages` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "pages" ADD COLUMN "families_cuid" TEXT NOT NULL; - --- CreateTable -CREATE TABLE "connected_accounts" ( - "cuid" TEXT NOT NULL, - "accountId" TEXT NOT NULL, - "country_of_residence" TEXT NOT NULL, - - CONSTRAINT "connected_accounts_pkey" PRIMARY KEY ("cuid") -); - --- CreateTable -CREATE TABLE "Family" ( - "cuid" TEXT NOT NULL, - "Stripe_Account_id" TEXT, - "Stripe_Accont_cuid" TEXT, - "family_member_cuids" TEXT[], - "family_relationship" TEXT NOT NULL, - "family_role" TEXT NOT NULL, - "created_at" TEXT NOT NULL DEFAULT '', - "updated_at" TEXT NOT NULL, - "advocate_cuid" TEXT NOT NULL, - - CONSTRAINT "Family_pkey" PRIMARY KEY ("cuid") -); - --- CreateIndex -CREATE UNIQUE INDEX "Family_advocate_cuid_key" ON "Family"("advocate_cuid"); - --- AddForeignKey -ALTER TABLE "Family" ADD CONSTRAINT "Family_advocate_cuid_fkey" FOREIGN KEY ("advocate_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_families_cuid_fkey" FOREIGN KEY ("families_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231021230454_eeerter/migration.sql b/prisma/migrations/20231021230454_eeerter/migration.sql deleted file mode 100644 index e3bc319c..00000000 --- a/prisma/migrations/20231021230454_eeerter/migration.sql +++ /dev/null @@ -1,29 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `family_member_cuids` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `family_relationship` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `family_role` on the `Family` table. All the data in the column will be lost. - - A unique constraint covering the columns `[pageCuid,url]` on the table `images` will be added. If there are existing duplicate values, this will fail. - -*/ --- DropForeignKey -ALTER TABLE "Family" DROP CONSTRAINT "Family_advocate_cuid_fkey"; - --- DropIndex -DROP INDEX "Family_advocate_cuid_key"; - --- AlterTable -ALTER TABLE "Family" DROP COLUMN "family_member_cuids", -DROP COLUMN "family_relationship", -DROP COLUMN "family_role"; - --- AlterTable -ALTER TABLE "user_accounts" ADD COLUMN "advocateCuid" TEXT NOT NULL DEFAULT '', -ADD COLUMN "familyCuid" TEXT NOT NULL DEFAULT ''; - --- CreateIndex -CREATE UNIQUE INDEX "images_pageCuid_url_key" ON "images"("pageCuid", "url"); - --- AddForeignKey -ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231021231138_ysfsdf/migration.sql b/prisma/migrations/20231021231138_ysfsdf/migration.sql deleted file mode 100644 index e8fa1d9f..00000000 --- a/prisma/migrations/20231021231138_ysfsdf/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `advocateCuid` on the `user_accounts` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE "user_accounts" DROP CONSTRAINT "user_accounts_familyCuid_fkey"; - --- AlterTable -ALTER TABLE "user_accounts" DROP COLUMN "advocateCuid", -ALTER COLUMN "familyCuid" DROP NOT NULL; - --- AddForeignKey -ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20231021232907_sdfsf/migration.sql b/prisma/migrations/20231021232907_sdfsf/migration.sql deleted file mode 100644 index d665a43c..00000000 --- a/prisma/migrations/20231021232907_sdfsf/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `familyCuid` on the `user_accounts` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE "user_accounts" DROP CONSTRAINT "user_accounts_familyCuid_fkey"; - --- AlterTable -ALTER TABLE "user_accounts" DROP COLUMN "familyCuid"; diff --git a/prisma/migrations/20231022050530_sfgdfgd/migration.sql b/prisma/migrations/20231022050530_sfgdfgd/migration.sql deleted file mode 100644 index 5cce17fc..00000000 --- a/prisma/migrations/20231022050530_sfgdfgd/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[familyCuid]` on the table `connected_accounts` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "connected_accounts" ADD COLUMN "familyCuid" TEXT NOT NULL DEFAULT ''; - --- AlterTable -ALTER TABLE "user_accounts" ADD COLUMN "familyCuid" TEXT DEFAULT ''; - --- CreateIndex -CREATE UNIQUE INDEX "connected_accounts_familyCuid_key" ON "connected_accounts"("familyCuid"); - --- AddForeignKey -ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "connected_accounts" ADD CONSTRAINT "connected_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231022050915_sdfdfsd/migration.sql b/prisma/migrations/20231022050915_sdfdfsd/migration.sql deleted file mode 100644 index 9929e7e3..00000000 --- a/prisma/migrations/20231022050915_sdfdfsd/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ --- DropForeignKey -ALTER TABLE "connected_accounts" DROP CONSTRAINT "connected_accounts_familyCuid_fkey"; - --- AlterTable -ALTER TABLE "connected_accounts" ALTER COLUMN "familyCuid" DROP NOT NULL, -ALTER COLUMN "familyCuid" DROP DEFAULT; - --- AddForeignKey -ALTER TABLE "connected_accounts" ADD CONSTRAINT "connected_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20231023013632_sdfsdf/migration.sql b/prisma/migrations/20231023013632_sdfsdf/migration.sql deleted file mode 100644 index 775cf8a7..00000000 --- a/prisma/migrations/20231023013632_sdfsdf/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `familyCuid` on the `connected_accounts` table. All the data in the column will be lost. - - You are about to drop the column `familyCuid` on the `user_accounts` table. All the data in the column will be lost. - -*/ --- DropForeignKey -ALTER TABLE "connected_accounts" DROP CONSTRAINT "connected_accounts_familyCuid_fkey"; - --- DropForeignKey -ALTER TABLE "user_accounts" DROP CONSTRAINT "user_accounts_familyCuid_fkey"; - --- DropIndex -DROP INDEX "connected_accounts_familyCuid_key"; - --- AlterTable -ALTER TABLE "Family" ALTER COLUMN "updated_at" SET DEFAULT ''; - --- AlterTable -ALTER TABLE "connected_accounts" DROP COLUMN "familyCuid"; - --- AlterTable -ALTER TABLE "user_accounts" DROP COLUMN "familyCuid"; diff --git a/prisma/migrations/20231108034813_/migration.sql b/prisma/migrations/20231108034813_/migration.sql deleted file mode 100644 index c279e486..00000000 --- a/prisma/migrations/20231108034813_/migration.sql +++ /dev/null @@ -1,66 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `family_cuid` on the `DonationPayout` table. All the data in the column will be lost. - - You are about to drop the column `Stripe_Accont_cuid` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `Stripe_Account_id` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `families_cuid` on the `pages` table. All the data in the column will be lost. - - You are about to drop the column `images` on the `pages` table. All the data in the column will be lost. - - You are about to drop the `connected_accounts` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `family_name` to the `Family` table without a default value. This is not possible if the table is not empty. - - Added the required column `user_cuid` to the `pages` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "DonationPayout" DROP CONSTRAINT "DonationPayout_family_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "page_donations" DROP CONSTRAINT "page_donations_family_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "pages" DROP CONSTRAINT "pages_families_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "pages" DROP CONSTRAINT "pages_family_cuid_fkey"; - --- AlterTable -ALTER TABLE "DonationPayout" DROP COLUMN "family_cuid", -ADD COLUMN "familyCuid" TEXT; - --- AlterTable -ALTER TABLE "Family" DROP COLUMN "Stripe_Accont_cuid", -DROP COLUMN "Stripe_Account_id", -ADD COLUMN "family_name" TEXT NOT NULL, -ADD COLUMN "stripe_account_id" TEXT; - --- AlterTable -ALTER TABLE "pages" DROP COLUMN "families_cuid", -DROP COLUMN "images", -ADD COLUMN "user_cuid" TEXT NOT NULL, -ALTER COLUMN "day_of_birth" DROP NOT NULL, -ALTER COLUMN "day_of_passing" DROP NOT NULL, -ALTER COLUMN "family_cuid" DROP NOT NULL; - --- AlterTable -ALTER TABLE "user_accounts" ADD COLUMN "familyCuid" TEXT; - --- DropTable -DROP TABLE "connected_accounts"; - --- AddForeignKey -ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Family" ADD CONSTRAINT "Family_advocate_cuid_fkey" FOREIGN KEY ("advocate_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "DonationPayout" ADD CONSTRAINT "DonationPayout_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_user_cuid_fkey" FOREIGN KEY ("user_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231208005442_tweak/migration.sql b/prisma/migrations/20231208005442_tweak/migration.sql deleted file mode 100644 index d4252432..00000000 --- a/prisma/migrations/20231208005442_tweak/migration.sql +++ /dev/null @@ -1,74 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `family_cuid` on the `DonationPayout` table. All the data in the column will be lost. - - You are about to drop the column `Stripe_Accont_cuid` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `Stripe_Account_id` on the `Family` table. All the data in the column will be lost. - - You are about to drop the column `families_cuid` on the `pages` table. All the data in the column will be lost. - - You are about to drop the column `images` on the `pages` table. All the data in the column will be lost. - - You are about to drop the `connected_accounts` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `familly_cuid` to the `DonationPayout` table without a default value. This is not possible if the table is not empty. - - Added the required column `family_name` to the `Family` table without a default value. This is not possible if the table is not empty. - - Added the required column `user_cuid` to the `page_donations` table without a default value. This is not possible if the table is not empty. - - Added the required column `user_cuid` to the `pages` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "DonationPayout" DROP CONSTRAINT "DonationPayout_family_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "page_donations" DROP CONSTRAINT "page_donations_family_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "pages" DROP CONSTRAINT "pages_families_cuid_fkey"; - --- DropForeignKey -ALTER TABLE "pages" DROP CONSTRAINT "pages_family_cuid_fkey"; - --- AlterTable -ALTER TABLE "DonationPayout" DROP COLUMN "family_cuid", -ADD COLUMN "familly_cuid" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "Family" DROP COLUMN "Stripe_Accont_cuid", -DROP COLUMN "Stripe_Account_id", -ADD COLUMN "family_name" TEXT NOT NULL, -ADD COLUMN "stripe_Account_id" TEXT; - --- AlterTable -ALTER TABLE "page_donations" ADD COLUMN "user_cuid" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "pages" DROP COLUMN "families_cuid", -DROP COLUMN "images", -ADD COLUMN "user_cuid" TEXT NOT NULL, -ALTER COLUMN "day_of_birth" DROP NOT NULL, -ALTER COLUMN "day_of_passing" DROP NOT NULL, -ALTER COLUMN "family_cuid" DROP NOT NULL; - --- AlterTable -ALTER TABLE "user_accounts" ADD COLUMN "familyCuid" TEXT; - --- DropTable -DROP TABLE "connected_accounts"; - --- AddForeignKey -ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Family" ADD CONSTRAINT "Family_advocate_cuid_fkey" FOREIGN KEY ("advocate_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "DonationPayout" ADD CONSTRAINT "DonationPayout_familly_cuid_fkey" FOREIGN KEY ("familly_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_user_cuid_fkey" FOREIGN KEY ("user_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "pages" ADD CONSTRAINT "pages_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_user_cuid_fkey" FOREIGN KEY ("user_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20231208005605_tweak/migration.sql b/prisma/migrations/20231208005605_tweak/migration.sql deleted file mode 100644 index 89836c0f..00000000 --- a/prisma/migrations/20231208005605_tweak/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `stripe_Account_id` on the `Family` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Family" DROP COLUMN "stripe_Account_id", -ADD COLUMN "stripe_account_id" TEXT; diff --git a/prisma/migrations/20231215210457_initial/migration.sql b/prisma/migrations/20231215210457_initial/migration.sql new file mode 100644 index 00000000..d522b795 --- /dev/null +++ b/prisma/migrations/20231215210457_initial/migration.sql @@ -0,0 +1,144 @@ +-- CreateTable +CREATE TABLE "user_accounts" ( + "cuid" TEXT NOT NULL, + "email" TEXT NOT NULL, + "user_role" TEXT NOT NULL DEFAULT 'family', + "first_name" TEXT NOT NULL DEFAULT '', + "middle_name" TEXT NOT NULL DEFAULT '', + "last_name" TEXT NOT NULL DEFAULT '', + "phone" TEXT NOT NULL DEFAULT '', + "familyCuid" TEXT, + + CONSTRAINT "user_accounts_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "Family" ( + "cuid" TEXT NOT NULL, + "family_name" TEXT NOT NULL, + "stripe_account_id" TEXT, + "created_at" TEXT NOT NULL DEFAULT '', + "updated_at" TEXT NOT NULL DEFAULT '', + "advocate_cuid" TEXT NOT NULL, + + CONSTRAINT "Family_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "DonationPayout" ( + "cuid" TEXT NOT NULL, + "familly_cuid" TEXT NOT NULL, + "page_cuid" TEXT NOT NULL, + "transaction_id" TEXT NOT NULL, + "amount" INTEGER NOT NULL DEFAULT 0, + "distributionDate" TEXT NOT NULL, + + CONSTRAINT "DonationPayout_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "pages" ( + "cuid" TEXT NOT NULL, + "page_name" TEXT NOT NULL, + "day_of_birth" TEXT, + "day_of_passing" TEXT, + "visitation_date" TEXT, + "visitation_location" TEXT NOT NULL, + "visitation_description" TEXT NOT NULL, + "funeral_date" TEXT, + "funeral_location" TEXT NOT NULL, + "funeral_description" TEXT NOT NULL, + "obituary" TEXT NOT NULL, + "donation_goal" INTEGER NOT NULL DEFAULT 0, + "amount_raised" INTEGER NOT NULL DEFAULT 0, + "deadline" TEXT NOT NULL, + "user_cuid" TEXT NOT NULL, + "amount_distributed" INTEGER NOT NULL DEFAULT 0, + "profile_image_cuid" TEXT NOT NULL, + "family_cuid" TEXT, + "status" TEXT NOT NULL DEFAULT 'active', + "donation_status" TEXT NOT NULL DEFAULT 'in progress', + "duration" TEXT NOT NULL DEFAULT '0 days', + "start_date" TEXT NOT NULL DEFAULT '', + "goal_met_date" TEXT NOT NULL DEFAULT '', + + CONSTRAINT "pages_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "page_donations" ( + "cuid" TEXT NOT NULL, + "family_cuid" TEXT NOT NULL, + "page_cuid" TEXT NOT NULL, + "donorFirstName" TEXT NOT NULL DEFAULT '', + "donorLastName" TEXT NOT NULL DEFAULT '', + "comments" TEXT NOT NULL DEFAULT '', + "isAnonymous" BOOLEAN NOT NULL DEFAULT false, + "success" BOOLEAN NOT NULL DEFAULT false, + "transaction_id" TEXT NOT NULL, + "amount" INTEGER NOT NULL, + + CONSTRAINT "page_donations_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "Reply" ( + "cuid" TEXT NOT NULL, + "page_cuid" TEXT NOT NULL, + "family_cuid" TEXT NOT NULL, + "reply" TEXT NOT NULL DEFAULT '', + "name" TEXT DEFAULT '', + + CONSTRAINT "Reply_pkey" PRIMARY KEY ("cuid") +); + +-- CreateTable +CREATE TABLE "images" ( + "cuid" TEXT NOT NULL, + "url" TEXT NOT NULL, + "pageCuid" TEXT, + + CONSTRAINT "images_pkey" PRIMARY KEY ("cuid") +); + +-- CreateIndex +CREATE UNIQUE INDEX "user_accounts_email_key" ON "user_accounts"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "DonationPayout_transaction_id_key" ON "DonationPayout"("transaction_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "page_donations_transaction_id_key" ON "page_donations"("transaction_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "images_pageCuid_url_key" ON "images"("pageCuid", "url"); + +-- AddForeignKey +ALTER TABLE "user_accounts" ADD CONSTRAINT "user_accounts_familyCuid_fkey" FOREIGN KEY ("familyCuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Family" ADD CONSTRAINT "Family_advocate_cuid_fkey" FOREIGN KEY ("advocate_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "DonationPayout" ADD CONSTRAINT "DonationPayout_familly_cuid_fkey" FOREIGN KEY ("familly_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "DonationPayout" ADD CONSTRAINT "DonationPayout_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "pages" ADD CONSTRAINT "pages_user_cuid_fkey" FOREIGN KEY ("user_cuid") REFERENCES "user_accounts"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "pages" ADD CONSTRAINT "pages_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_family_cuid_fkey" FOREIGN KEY ("family_cuid") REFERENCES "Family"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "page_donations" ADD CONSTRAINT "page_donations_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Reply" ADD CONSTRAINT "Reply_page_cuid_fkey" FOREIGN KEY ("page_cuid") REFERENCES "pages"("cuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "images" ADD CONSTRAINT "images_pageCuid_fkey" FOREIGN KEY ("pageCuid") REFERENCES "pages"("cuid") ON DELETE SET NULL ON UPDATE CASCADE;