-
Notifications
You must be signed in to change notification settings - Fork 501
transactions rework #1089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
transactions rework #1089
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
16c3eba
transactions rework
BilalG1 ecd4333
fix type issue
BilalG1 956c11f
type-check
BilalG1 77c6637
fix migration issue
BilalG1 73fec07
type fixes
BilalG1 a91b8ff
type checks
BilalG1 08b27cb
Merge branch 'dev' into transactions-rework
BilalG1 977836b
transactions rework integration (#1092)
BilalG1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
apps/backend/prisma/migrations/20260107160000_add_transaction_tables/migration.sql
This file contains hidden or 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,80 @@ | ||
| -- CreateEnum | ||
| CREATE TYPE "SubscriptionChangeType" AS ENUM ('PRICE_CHANGE', 'QUANTITY_CHANGE', 'PERIOD_CHANGE', 'STATUS_CHANGE', 'METADATA_CHANGE', 'OTHER'); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "StripeRefund" ( | ||
| "id" UUID NOT NULL, | ||
| "tenancyId" UUID NOT NULL, | ||
| "stripeRefundId" TEXT NOT NULL, | ||
| "stripePaymentIntentId" TEXT, | ||
| "subscriptionId" UUID, | ||
| "oneTimePurchaseId" UUID, | ||
| "customerId" TEXT NOT NULL, | ||
| "customerType" "CustomerType" NOT NULL, | ||
| "amountCents" INTEGER NOT NULL, | ||
| "currency" TEXT NOT NULL, | ||
| "reason" TEXT, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "StripeRefund_pkey" PRIMARY KEY ("tenancyId","id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "ProductChange" ( | ||
| "id" UUID NOT NULL, | ||
| "tenancyId" UUID NOT NULL, | ||
| "customerId" TEXT NOT NULL, | ||
| "customerType" "CustomerType" NOT NULL, | ||
| "subscriptionId" UUID, | ||
BilalG1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "oldProductId" TEXT, | ||
| "oldPriceId" TEXT, | ||
| "oldProduct" JSONB, | ||
| "newProductId" TEXT, | ||
| "newPriceId" TEXT, | ||
| "newProduct" JSONB, | ||
| "oldQuantity" INTEGER NOT NULL DEFAULT 1, | ||
| "newQuantity" INTEGER NOT NULL DEFAULT 1, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "ProductChange_pkey" PRIMARY KEY ("tenancyId","id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "SubscriptionChange" ( | ||
| "id" UUID NOT NULL, | ||
| "tenancyId" UUID NOT NULL, | ||
| "subscriptionId" UUID NOT NULL, | ||
| "customerId" TEXT NOT NULL, | ||
| "customerType" "CustomerType" NOT NULL, | ||
| "changeType" "SubscriptionChangeType" NOT NULL, | ||
| "oldValue" JSONB, | ||
| "newValue" JSONB, | ||
| "description" TEXT, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
|
||
| CONSTRAINT "SubscriptionChange_pkey" PRIMARY KEY ("tenancyId","id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "StripeRefund_tenancyId_stripeRefundId_key" ON "StripeRefund"("tenancyId", "stripeRefundId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "StripeRefund_tenancyId_subscriptionId_idx" ON "StripeRefund"("tenancyId", "subscriptionId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "StripeRefund_tenancyId_oneTimePurchaseId_idx" ON "StripeRefund"("tenancyId", "oneTimePurchaseId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ProductChange_tenancyId_subscriptionId_idx" ON "ProductChange"("tenancyId", "subscriptionId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ProductChange_tenancyId_customerId_idx" ON "ProductChange"("tenancyId", "customerId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "SubscriptionChange_tenancyId_subscriptionId_idx" ON "SubscriptionChange"("tenancyId", "subscriptionId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "SubscriptionChange_tenancyId_customerId_idx" ON "SubscriptionChange"("tenancyId", "customerId"); | ||
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.