-
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.
Merge remote-tracking branch 'origin/main' into jessica/donations-routes
- Loading branch information
Showing
6 changed files
with
147 additions
and
15 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 |
---|---|---|
@@ -1 +1,5 @@ | ||
# don-efficace | ||
# don-efficace | ||
|
||
# Useful commands to run prisma | ||
"npx prisma db push" to push | ||
"npx prisma studio" to run prisma |
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
83 changes: 83 additions & 0 deletions
83
backend/typescript/prisma/migrations/20240225001117_feb25/migration.sql
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,83 @@ | ||
-- CreateEnum | ||
CREATE TYPE "CauseEnum" AS ENUM ('ENVIRONMENT', 'EDUCATION', 'HEALTH'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" SERIAL NOT NULL, | ||
"first_name" TEXT NOT NULL, | ||
"last_name" TEXT NOT NULL, | ||
"full_addr" TEXT NOT NULL, | ||
"email_addr" TEXT NOT NULL, | ||
"opt_in" BOOLEAN NOT NULL, | ||
"date_created" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"is_admin" BOOLEAN NOT NULL DEFAULT false, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Donation" ( | ||
"id" SERIAL NOT NULL, | ||
"user_id" INTEGER NOT NULL, | ||
"amount" DOUBLE PRECISION NOT NULL, | ||
"donation_date" TIMESTAMP(3) NOT NULL, | ||
"is_recurring" BOOLEAN NOT NULL, | ||
"confirmation_email_sent" BOOLEAN NOT NULL, | ||
|
||
CONSTRAINT "Donation_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "CauseDonation" ( | ||
"donation_id" INTEGER NOT NULL, | ||
"cause_id" INTEGER NOT NULL, | ||
|
||
CONSTRAINT "CauseDonation_pkey" PRIMARY KEY ("donation_id","cause_id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Cause" ( | ||
"id" SERIAL NOT NULL, | ||
"name" "CauseEnum" NOT NULL, | ||
"description" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Cause_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "NPO" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"contact_information" TEXT NOT NULL, | ||
"cause_id" INTEGER NOT NULL, | ||
"item_id" INTEGER, | ||
|
||
CONSTRAINT "NPO_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Item" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"impact_ratio" DOUBLE PRECISION NOT NULL, | ||
|
||
CONSTRAINT "Item_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_addr_key" ON "User"("email_addr"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Donation" ADD CONSTRAINT "Donation_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CauseDonation" ADD CONSTRAINT "CauseDonation_donation_id_fkey" FOREIGN KEY ("donation_id") REFERENCES "Donation"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "CauseDonation" ADD CONSTRAINT "CauseDonation_cause_id_fkey" FOREIGN KEY ("cause_id") REFERENCES "Cause"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "NPO" ADD CONSTRAINT "NPO_cause_id_fkey" FOREIGN KEY ("cause_id") REFERENCES "Cause"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "NPO" ADD CONSTRAINT "NPO_item_id_fkey" FOREIGN KEY ("item_id") REFERENCES "Item"("id") ON DELETE SET NULL 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,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
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 |
---|---|---|
|
@@ -800,6 +800,47 @@ | |
"@nodelib/fs.scandir" "2.1.4" | ||
fastq "^1.6.0" | ||
|
||
"@prisma/client@^5.10.2": | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.10.2.tgz#e087b40a4de8e3171eb9cbf0a873465cd2068e17" | ||
integrity sha512-ef49hzB2yJZCvM5gFHMxSFL9KYrIP9udpT5rYo0CsHD4P9IKj473MbhU1gjKKftiwWBTIyrt9jukprzZXazyag== | ||
|
||
"@prisma/[email protected]": | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.10.2.tgz#74be81d8969978f4d53c1b4e76d61f04bfbc3951" | ||
integrity sha512-bkBOmH9dpEBbMKFJj8V+Zp8IZHIBjy3fSyhLhxj4FmKGb/UBSt9doyfA6k1UeUREsMJft7xgPYBbHSOYBr8XCA== | ||
|
||
"@prisma/engines-version@5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9": | ||
version "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9" | ||
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9.tgz#1502335d4d72d2014cb25b8ad8a740a3a13400ea" | ||
integrity sha512-uCy/++3Jx/O3ufM+qv2H1L4tOemTNqcP/gyEVOlZqTpBvYJUe0tWtW0y3o2Ueq04mll4aM5X3f6ugQftOSLdFQ== | ||
|
||
"@prisma/[email protected]": | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.10.2.tgz#a4851d90f76ad6d22e783d5fd2e2e8c0640f1e81" | ||
integrity sha512-HkSJvix6PW8YqEEt3zHfCYYJY69CXsNdhU+wna+4Y7EZ+AwzeupMnUThmvaDA7uqswiHkgm5/SZ6/4CStjaGmw== | ||
dependencies: | ||
"@prisma/debug" "5.10.2" | ||
"@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9" | ||
"@prisma/fetch-engine" "5.10.2" | ||
"@prisma/get-platform" "5.10.2" | ||
|
||
"@prisma/[email protected]": | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.10.2.tgz#a061f6727d395c7033b55f9c6e92f8741a70d5c5" | ||
integrity sha512-dSmXcqSt6DpTmMaLQ9K8ZKzVAMH3qwGCmYEZr/uVnzVhxRJ1EbT/w2MMwIdBNq1zT69Rvh0h75WMIi0mrIw7Hg== | ||
dependencies: | ||
"@prisma/debug" "5.10.2" | ||
"@prisma/engines-version" "5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9" | ||
"@prisma/get-platform" "5.10.2" | ||
|
||
"@prisma/[email protected]": | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.10.2.tgz#7af97b1d82e5574a474e3fbf6eaf04f4156bc535" | ||
integrity sha512-nqXP6vHiY2PIsebBAuDeWiUYg8h8mfjBckHh6Jezuwej0QJNnjDiOq30uesmg+JXxGk99nqyG3B7wpcOODzXvg== | ||
dependencies: | ||
"@prisma/debug" "5.10.2" | ||
|
||
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" | ||
|
@@ -5600,6 +5641,13 @@ pretty-format@^27.0.6: | |
ansi-styles "^5.0.0" | ||
react-is "^17.0.1" | ||
|
||
prisma@^5.10.2: | ||
version "5.10.2" | ||
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.10.2.tgz#aa63085c49dc74cdb5c3816e8dd1fb4d74a2aadd" | ||
integrity sha512-hqb/JMz9/kymRE25pMWCxkdyhbnIWrq+h7S6WysJpdnCvhstbJSNP/S6mScEcqiB8Qv2F+0R3yG+osRaWqZacQ== | ||
dependencies: | ||
"@prisma/engines" "5.10.2" | ||
|
||
process-nextick-args@~2.0.0: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" | ||
|