IEMS - Integrated E-Commerce Management System

6.2

Database Design

6.2.1. Data Dictionary

This database design is generated from the uploaded Prisma schema. It covers authentication, buyer, seller, product catalog, inventory, order, return, wallet, payout, promotion, message and notification modules for a multi-vendor e-commerce system.

49 Tables 822 Prisma Fields 622 DB Columns / Enums 200 Relations 107 Indexes 33 Enums PostgreSQL Database

Architecture Snapshot

Database Modules

Auth & Users7 tables

Accounts, sessions, OTPs, audit logs and deletion flows

Buyer3 tables

Cart, wishlist and delivery address data

Catalog & Inventory10 tables

Categories, HSN codes, products, variants, images, views, A+ content and stock

Orders & Returns5 tables

Buyer orders, seller orders, order items, status timeline and returns

Seller, Wallet & Payouts8 tables

Seller KYC, bank verification, trademarks, wallet, payout and debt records

Deals & Coupons6 tables

Promotions, deals, coupons, clips and redemptions

Engagement & Messaging7 tables

Reviews, Q&A, conversation threads and seller-buyer messages

Notifications2 tables

User notifications and processed webhooks

Countries1 tables

Country master data for onboarding and marketplace operations

User & Roles

User accounts connect to BuyerProfile or SellerProfile, then fan out to cart, orders, products, messages and notifications.

Catalog

Category -> Product -> ProductVariant/ProductImage forms the main product listing structure.

Order Flow

Order -> SellerOrder -> OrderItem -> OrderStatusHistory/ReturnRequest supports marketplace order splitting.

Seller Money

SellerOrder and OrderItem create wallet transactions; verified bank details enable PayoutRequest withdrawals.

Engagement

Reviews, seller ratings, product Q&A, conversations and notifications connect customers with sellers.

Promotions

Deals and Coupons attach to seller products and track buyer clips/redemptions.

PK Primary key FK Foreign key UQ Unique constraint IDX Indexed field REL Prisma virtual relation field

Table 01 / Auth & Users

1) Table Name: User

Stores login identity, role, verification status and account lifecycle state for buyers, sellers and admins.

auth.prisma38 fields24 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 email String UQIDX No seller@example.com User email address used for authentication and communication.
@unique
3 phone String? UQIDX Yes +91 9876543210 Mobile phone number used for verification and contact.
@unique
4 profileName String? - Yes Sample Name Stores profile name.
-
5 passwordHash String? - Yes text Hashed password value. Plaintext password is never stored.
-
6 role Role IDX No BUYER Enum value from Role (BUYER, SELLER, ADMIN).
-
7 accountSetupPhase AccountSetupPhase - No PENDING Enum value from AccountSetupPhase (PENDING, EMAIL_VERIFIED, PHONE_VERIFIED, KYC_VERIFIED, BANK_VERIFIED, TRADEMARK_SUBMITTED...).
@default(PENDING)
8 userProfileStatus UserProfileStatus IDX No PENDING Enum value from UserProfileStatus (PENDING, ACTIVE, SUSPENDED, DELETED).
@default(PENDING)
9 isEmailVerified Boolean - No false Boolean flag for is email verified.
@default(false)
10 isPhoneVerified Boolean - No false Boolean flag for is phone verified.
@default(false)
11 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
12 roleId String? - Yes uuid To store the current role ID (e.g., buyer role ID, seller role ID, or admin role ID)
-
13 createdAt DateTime - No now() Record creation timestamp.
@default(now())
14 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
15 loginSessions LoginSessions[] REL No LoginSessions[] Virtual Prisma back-relation containing related LoginSessions records.
-
16 otps Otp[] REL No Otp[] Virtual Prisma back-relation containing related Otp records.
-
17 auditLogs AuditLog[] REL No AuditLog[] Virtual Prisma back-relation containing related AuditLog records.
-
18 buyerProfile BuyerProfile? REL Yes BuyerProfile Virtual Prisma relation to BuyerProfile.
-
19 cartItems CartItem[] REL No CartItem[] Virtual Prisma back-relation containing related CartItem records.
@relation("CartItemBuyer")
20 wishlistItems WishlistItem[] REL No WishlistItem[] Virtual Prisma back-relation containing related WishlistItem records.
@relation("WishlistItemBuyer")
21 addresses Address[] REL No Address[] Virtual Prisma back-relation containing related Address records.
@relation("BuyerAddresses")
22 sellerProfile SellerProfile? REL Yes SellerProfile Virtual Prisma relation to SellerProfile.
-
23 deletionRequest DeletionRequest? REL Yes DeletionRequest Virtual Prisma relation to DeletionRequest.
-
24 tradeMarks TradMark[] REL No TradMark[] Virtual Prisma back-relation containing related TradMark records.
-
25 buyerOrders Order[] REL No Order[] Virtual Prisma back-relation containing related Order records.
@relation("BuyerOrders")
26 returnRequests ReturnRequest[] REL No ReturnRequest[] Virtual Prisma back-relation containing related ReturnRequest records.
@relation("ReturnRequestBuyer")
27 sellerRatingsGiven SellerRating[] REL No SellerRating[] Virtual Prisma back-relation containing related SellerRating records.
@relation("SellerRatingBuyer")
28 productReviews ProductReview[] REL No ProductReview[] Virtual Prisma back-relation containing related ProductReview records.
@relation("ProductReviewBuyer")
29 reviewHelpfulVotes ReviewHelpfulVote[] REL No ReviewHelpfulVote[] Virtual Prisma back-relation containing related ReviewHelpfulVote records.
@relation("ReviewHelpfulVoteBuyer")
30 productQuestions ProductQuestion[] REL No ProductQuestion[] Virtual Prisma back-relation containing related ProductQuestion records.
@relation("ProductQuestionBuyer")
31 stockBackAlerts StockBackAlert[] REL No StockBackAlert[] Virtual Prisma back-relation containing related StockBackAlert records.
@relation("StockBackAlertBuyer")
32 productViews ProductView[] REL No ProductView[] Virtual Prisma back-relation containing related ProductView records.
@relation("ProductViewBuyer")
33 notifications Notification[] REL No Notification[] Virtual Prisma back-relation containing related Notification records.
@relation("NotificationRecipient")
34 sentMessages Message[] REL No Message[] Virtual Prisma back-relation containing related Message records.
@relation("MessageSender")
35 receivedMessages Message[] REL No Message[] Virtual Prisma back-relation containing related Message records.
@relation("MessageReceiver")
36 buyerConversationThreads ConversationThread[] REL No ConversationThread[] Virtual Prisma back-relation containing related ConversationThread records.
@relation("BuyerConversationThreads")
37 couponClips CouponClip[] REL No CouponClip[] Virtual Prisma back-relation containing related CouponClip records.
@relation("CouponClipBuyer")
38 couponRedemptions CouponRedemption[] REL No CouponRedemption[] Virtual Prisma back-relation containing related CouponRedemption records.
@relation("CouponRedemptionBuyer")
Relationship summary (24)
  • loginSessions -> LoginSessions Back relation / one-to-many collection
  • otps -> Otp Back relation / one-to-many collection
  • auditLogs -> AuditLog Back relation / one-to-many collection
  • buyerProfile -> BuyerProfile Optional/one-to-one virtual relation
  • cartItems -> CartItem Back relation / one-to-many collection
  • wishlistItems -> WishlistItem Back relation / one-to-many collection
  • addresses -> Address Back relation / one-to-many collection
  • sellerProfile -> SellerProfile Optional/one-to-one virtual relation
  • deletionRequest -> DeletionRequest Optional/one-to-one virtual relation
  • tradeMarks -> TradMark Back relation / one-to-many collection
  • buyerOrders -> Order Back relation / one-to-many collection
  • returnRequests -> ReturnRequest Back relation / one-to-many collection
  • sellerRatingsGiven -> SellerRating Back relation / one-to-many collection
  • productReviews -> ProductReview Back relation / one-to-many collection
  • reviewHelpfulVotes -> ReviewHelpfulVote Back relation / one-to-many collection
  • productQuestions -> ProductQuestion Back relation / one-to-many collection
  • stockBackAlerts -> StockBackAlert Back relation / one-to-many collection
  • productViews -> ProductView Back relation / one-to-many collection
  • notifications -> Notification Back relation / one-to-many collection
  • sentMessages -> Message Back relation / one-to-many collection
  • receivedMessages -> Message Back relation / one-to-many collection
  • buyerConversationThreads -> ConversationThread Back relation / one-to-many collection
  • couponClips -> CouponClip Back relation / one-to-many collection
  • couponRedemptions -> CouponRedemption Back relation / one-to-many collection
Indexes & constraints (3)
  • @@index([email, isDeleted])
  • @@index([phone, isDeleted])
  • @@index([role, userProfileStatus, isDeleted])

Table 02 / Auth & Users

2) Table Name: LoginSessions

Stores refresh-token sessions, expiry, device and IP metadata for secure authentication.

auth.prisma11 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 userId String FKIDX No uuid Foreign key reference to User.id.
-
3 refreshTokenHash String IDX No text SHA-256 — plaintext never stored
-
4 expiresAt DateTime IDX No now() Date/time value for expires at.
-
5 ipAddress String? - Yes text Stores ip address.
-
6 userAgent String? - Yes text Stores user agent.
-
7 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
8 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
9 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
10 createdAt DateTime - No now() Record creation timestamp.
@default(now())
11 user User REL No User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
Relationship summary (1)
  • user -> User userId -> User.id
Indexes & constraints (3)
  • @@index([userId, isDeleted])
  • @@index([refreshTokenHash])
  • @@index([expiresAt])

Table 03 / Auth & Users

3) Table Name: Otp

Stores hashed OTPs for verification, login, password reset and account deletion workflows.

auth.prisma10 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 identity String UQ* No text email or phone
-
3 channel OtpChannel UQ* No email Enum value from OtpChannel (email, phone).
-
4 purpose OtpPurpose UQ* No VERIFICATION_OTP Enum value from OtpPurpose (VERIFICATION_OTP, LOGIN_OTP, PASSWORD_RESET_OTP, ACCOUNT_DELETION_OTP).
-
5 hash String - No text SHA-256 of plaintext OTP
-
6 expiresAt DateTime IDX No now() Date/time value for expires at.
-
7 attempts Int - No 0 Stores attempts.
@default(0)
8 userId String? FK Yes uuid Foreign key reference to User.id.
-
9 createdAt DateTime - No now() Record creation timestamp.
@default(now())
10 user User? REL Yes User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
Relationship summary (1)
  • user -> User userId -> User.id
Indexes & constraints (2)
  • @@unique([identity, channel, purpose])
  • @@index([expiresAt])

Table 04 / Auth & Users

4) Table Name: PermenentDeletedCredentials

Keeps blocked credentials from permanently deleted accounts to prevent reuse where required.

auth.prisma5 fields0 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 email String? UQ* Yes seller@example.com User email address used for authentication and communication.
-
3 phone String? UQ* Yes +91 9876543210 Mobile phone number used for verification and contact.
-
4 brandName String? UQ* Yes Sample Name Stores brand name.
-
5 deletedAt DateTime - No now() Timestamp when the record was soft-deleted.
@default(now())
Indexes & constraints (3)
  • @@unique([email])
  • @@unique([phone])
  • @@unique([brandName])

Table 05 / Auth & Users

5) Table Name: BuyerProfile

Extends a user account with buyer-specific profile data.

auth.prisma3 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 userId String UQFK No uuid Foreign key reference to User.id.
@unique
3 user User REL No User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
Relationship summary (1)
  • user -> User userId -> User.id

Table 06 / Auth & Users

6) Table Name: AuditLog

Tracks security and account events with optional metadata for admin review and compliance.

auth.prisma10 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 userId String FKIDX No uuid Foreign key reference to User.id.
-
3 event AuditEvent IDX No BUYER_SIGNUP Enum value from AuditEvent (BUYER_SIGNUP, BUYER_LOGIN, SELLER_SIGNUP, SELLER_LOGIN, PASSWORD_RESET, ACCOUNT_DELETION...).
-
4 resourceId String? IDX Yes uuid ID of the resource affected
-
5 resourceType String? IDX Yes text Type of the resource
-
6 ipAddress String? - Yes text Stores ip address.
-
7 userAgent String? - Yes text Stores user agent.
-
8 metadata Json? - Yes {} Flexible JSON metadata for extra provider or audit information.
-
9 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
10 user User REL No User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
Relationship summary (1)
  • user -> User userId -> User.id
Indexes & constraints (3)
  • @@index([userId, event])
  • @@index([resourceId, resourceType])
  • @@index([createdAt])

Table 07 / Auth & Users

7) Table Name: DeletionRequest

Stores account deletion requests, approval status, cooling-off period and seller final-settlement payout link.

auth.prisma13 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 userId String UQFK No uuid Foreign key reference to User.id.
@unique
3 reason String - No text Stores reason.
-
4 reasonDetail String? - Yes text Stores reason detail.
-
5 status String - No "PENDING_ADMIN_APPROVAL" Current workflow or lifecycle status.
@default("PENDING_ADMIN_APPROVAL")
6 adminNote String? - Yes text Stores admin note.
-
7 requestedAt DateTime - No now() Date/time value for requested at.
@default(now())
8 resolvedAt DateTime? - Yes now() Date/time value for resolved at.
-
9 coolingOffUntil DateTime? - Yes now() Stores cooling off until.
-
10 sellerExitSettlementAmount Decimal?Decimal(14, 2) - Yes 0.00 Monetary/decimal value for seller exit settlement amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
11 sellerExitPayoutId String? UQFK Yes uuid Foreign key reference to PayoutRequest.id.
@unique
12 user User REL No User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
13 sellerExitPayout PayoutRequest? REL Yes PayoutRequest Virtual Prisma relation to PayoutRequest.
@relation(fields: [sellerExitPayoutId], references: [id])
Relationship summary (2)
  • user -> User userId -> User.id
  • sellerExitPayout -> PayoutRequest sellerExitPayoutId -> PayoutRequest.id

Table 08 / Buyer

8) Table Name: CartItem

Stores active and soft-deleted cart items selected by a buyer.

buyer.prisma12 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
3 productId String FKIDX No uuid Foreign key reference to Product.id.
-
4 variantId String? FKIDX Yes uuid Foreign key reference to ProductVariant.id.
-
5 qty Int - No 0 Quantity selected by the buyer.
-
6 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
7 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
8 createdAt DateTime - No now() Record creation timestamp.
@default(now())
9 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
10 buyer User REL No User Virtual Prisma relation to User.
@relation("CartItemBuyer", fields: [buyerId], references: [id])
11 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
12 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
Relationship summary (3)
  • buyer -> User buyerId -> User.id
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
Indexes & constraints (4)
  • @@index([buyerId, isDeleted])
  • @@index([productId])
  • @@index([variantId])
  • @@index([buyerId, productId, variantId, isDeleted])

Table 09 / Buyer

9) Table Name: WishlistItem

Stores buyer wishlist entries for products and variants.

buyer.prisma11 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
3 productId String FKIDX No uuid Foreign key reference to Product.id.
-
4 variantId String? FKIDX Yes uuid Foreign key reference to ProductVariant.id.
-
5 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
6 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
7 createdAt DateTime - No now() Record creation timestamp.
@default(now())
8 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
9 buyer User REL No User Virtual Prisma relation to User.
@relation("WishlistItemBuyer", fields: [buyerId], references: [id])
10 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
11 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
Relationship summary (3)
  • buyer -> User buyerId -> User.id
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
Indexes & constraints (4)
  • @@index([buyerId, isDeleted])
  • @@index([productId])
  • @@index([variantId])
  • @@index([buyerId, productId, variantId, isDeleted])

Table 10 / Buyer

10) Table Name: Address

Stores buyer delivery and billing addresses with default address support.

buyer.prisma16 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
3 fullName String - No Sample Name Stores full name.
-
4 phone String - No +91 9876543210 Mobile phone number used for verification and contact.
-
5 addressLine1 String - No text Stores address line1.
-
6 addressLine2 String? - Yes text Stores address line2.
-
7 city String - No text Stores city.
-
8 state String - No text Stores state.
-
9 pinCode String - No CODE123 Stores pin code.
-
10 type String - No text Stores type.
-
11 isDefault Boolean IDX No false Marks this record as the default option.
@default(false)
12 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
13 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
14 createdAt DateTime - No now() Record creation timestamp.
@default(now())
15 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
16 buyer User REL No User Virtual Prisma relation to User.
@relation("BuyerAddresses", fields: [buyerId], references: [id])
Relationship summary (1)
  • buyer -> User buyerId -> User.id
Indexes & constraints (2)
  • @@index([buyerId, isDeleted])
  • @@index([buyerId, isDefault, isDeleted])

Table 11 / Deals & Coupons

11) Table Name: Deal

Defines seller deal campaigns such as lightning deals and best deals.

commerce.prisma14 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 title String - No text Display title.
-
4 dealType DealType - No LIGHTNING Enum value from DealType (LIGHTNING, BEST_DEAL).
-
5 status PromotionStatus IDX No DRAFT Current workflow or lifecycle status.
@default(DRAFT)
6 minDiscountPercent DecimalDecimal(5, 2) - No 15 Monetary/decimal value for min discount percent.
@default(15) @db.Decimal(5, 2) | DB: Decimal(5, 2)
7 startAt DateTime IDX No now() Date/time value for start at.
-
8 endAt DateTime IDX No now() Date/time value for end at.
-
9 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
10 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
11 createdAt DateTime - No now() Record creation timestamp.
@default(now())
12 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
13 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
14 products DealProduct[] REL No DealProduct[] Virtual Prisma back-relation containing related DealProduct records.
-
Relationship summary (2)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • products -> DealProduct Back relation / one-to-many collection
Indexes & constraints (2)
  • @@index([sellerId, status, startAt])
  • @@index([status, startAt, endAt])

Table 12 / Deals & Coupons

12) Table Name: DealProduct

Links deal campaigns to products/variants with deal pricing and sale limits.

commerce.prisma15 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 dealId String FKUQ* No uuid Foreign key reference to Deal.id.
-
3 productId String FKUQ*IDX No uuid Foreign key reference to Product.id.
-
4 variantId String? FKUQ* Yes uuid Foreign key reference to ProductVariant.id.
-
5 originalPrice DecimalDecimal(12, 2) - No 0.00 Monetary/decimal value for original price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
6 dealPrice DecimalDecimal(12, 2) - No 0.00 Monetary/decimal value for deal price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
7 discountPercent DecimalDecimal(5, 2) - No 0.00 Monetary/decimal value for discount percent.
@db.Decimal(5, 2) | DB: Decimal(5, 2)
8 quantityLimit Int? - Yes 0 Stores quantity limit.
-
9 unitsSold Int - No 0 Stores units sold.
@default(0)
10 revenueAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for revenue amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
11 createdAt DateTime - No now() Record creation timestamp.
@default(now())
12 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
13 deal Deal REL No Deal Virtual Prisma relation to Deal.
@relation(fields: [dealId], references: [id], onDelete: Cascade)
14 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
15 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
Relationship summary (3)
  • deal -> Deal dealId -> Deal.id
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
Indexes & constraints (2)
  • @@unique([dealId, productId, variantId])
  • @@index([productId])

Table 13 / Deals & Coupons

13) Table Name: Coupon

Defines seller coupon rules, discount amounts, usage limits and validity dates.

commerce.prisma27 fields5 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 code String UQ No CODE123 Stores code.
@unique
4 normalizedCode String UQ No CODE123 Stores normalized code.
@unique
5 status PromotionStatus IDX No DRAFT Current workflow or lifecycle status.
@default(DRAFT)
6 isActive Boolean - No false Active/inactive flag.
@default(false)
7 discountType DiscountType - No PERCENTAGE Enum value from DiscountType (PERCENTAGE, FIXED_AMOUNT).
-
8 discountValue DecimalDecimal(12, 2) - No 0.00 Monetary/decimal value for discount value.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
9 maxDiscountAmount Decimal?Decimal(12, 2) - Yes 0.00 Monetary/decimal value for max discount amount.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
10 minOrderValue Decimal?Decimal(12, 2) - Yes 0.00 Monetary/decimal value for min order value.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
11 applicability CouponApplicability - No ALL_SELLER_PRODUCTS Enum value from CouponApplicability (ALL_SELLER_PRODUCTS, SPECIFIC_PRODUCTS, CATEGORY).
@default(ALL_SELLER_PRODUCTS)
12 categoryId String? FKIDX Yes uuid Foreign key reference to Category.id.
-
13 startAt DateTime IDX No now() Date/time value for start at.
-
14 endAt DateTime - No now() Date/time value for end at.
-
15 maxRedemptions Int? - Yes 0 Stores max redemptions.
-
16 maxRedemptionsPerBuyer Int? - Yes 0 Stores max redemptions per buyer.
-
17 totalRedemptions Int - No 0 Stores total redemptions.
@default(0)
18 totalDiscountAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for total discount amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
19 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
20 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
21 createdAt DateTime - No now() Record creation timestamp.
@default(now())
22 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
23 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
24 category Category? REL Yes Category Virtual Prisma relation to Category.
@relation(fields: [categoryId], references: [id])
25 products CouponProduct[] REL No CouponProduct[] Virtual Prisma back-relation containing related CouponProduct records.
-
26 clips CouponClip[] REL No CouponClip[] Virtual Prisma back-relation containing related CouponClip records.
-
27 redemptions CouponRedemption[] REL No CouponRedemption[] Virtual Prisma back-relation containing related CouponRedemption records.
-
Relationship summary (5)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • category -> Category categoryId -> Category.id
  • products -> CouponProduct Back relation / one-to-many collection
  • clips -> CouponClip Back relation / one-to-many collection
  • redemptions -> CouponRedemption Back relation / one-to-many collection
Indexes & constraints (2)
  • @@index([sellerId, status, startAt])
  • @@index([categoryId])

Table 14 / Deals & Coupons

14) Table Name: CouponProduct

Links coupons to specific products or variants when coupon applicability is specific-products based.

commerce.prisma6 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 couponId String FKUQ* No uuid Foreign key reference to Coupon.id.
-
3 productId String FKUQ*IDX No uuid Foreign key reference to Product.id.
-
4 createdAt DateTime - No now() Record creation timestamp.
@default(now())
5 coupon Coupon REL No Coupon Virtual Prisma relation to Coupon.
@relation(fields: [couponId], references: [id], onDelete: Cascade)
6 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
Relationship summary (2)
  • coupon -> Coupon couponId -> Coupon.id
  • product -> Product productId -> Product.id
Indexes & constraints (2)
  • @@unique([couponId, productId])
  • @@index([productId])

Table 15 / Deals & Coupons

15) Table Name: CouponClip

Tracks buyers who saved or clipped a coupon before checkout.

commerce.prisma9 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 couponId String FKUQ* No uuid Foreign key reference to Coupon.id.
-
3 buyerId String FKUQ*IDX No uuid Foreign key reference to User.id.
-
4 productId String? FK Yes uuid Foreign key reference to Product.id.
-
5 isActive Boolean - No true Active/inactive flag.
@default(true)
6 clippedAt DateTime IDX No now() Date/time value for clipped at.
@default(now())
7 coupon Coupon REL No Coupon Virtual Prisma relation to Coupon.
@relation(fields: [couponId], references: [id], onDelete: Cascade)
8 buyer User REL No User Virtual Prisma relation to User.
@relation("CouponClipBuyer", fields: [buyerId], references: [id])
9 product Product? REL Yes Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
Relationship summary (3)
  • coupon -> Coupon couponId -> Coupon.id
  • buyer -> User buyerId -> User.id
  • product -> Product productId -> Product.id
Indexes & constraints (2)
  • @@unique([couponId, buyerId])
  • @@index([buyerId, clippedAt])

Table 16 / Deals & Coupons

16) Table Name: CouponRedemption

Tracks reserved, applied, released or cancelled coupon usage on orders.

commerce.prisma15 fields4 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 couponId String FKIDX No uuid Foreign key reference to Coupon.id.
-
3 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
4 orderId String? FKIDX Yes uuid Foreign key reference to Order.id.
-
5 sellerOrderId String? FKIDX Yes uuid Foreign key reference to SellerOrder.id.
-
6 status CouponRedemptionStatus IDX No RESERVED Current workflow or lifecycle status.
@default(RESERVED)
7 reservationKey String? UQ Yes text Stores reservation key.
@unique
8 discountAmount DecimalDecimal(12, 2) - No 0.00 Monetary/decimal value for discount amount.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
9 reservedAt DateTime - No now() Date/time value for reserved at.
@default(now())
10 redeemedAt DateTime? - Yes now() Date/time value for redeemed at.
-
11 releasedAt DateTime? - Yes now() Date/time value for released at.
-
12 coupon Coupon REL No Coupon Virtual Prisma relation to Coupon.
@relation(fields: [couponId], references: [id])
13 buyer User REL No User Virtual Prisma relation to User.
@relation("CouponRedemptionBuyer", fields: [buyerId], references: [id])
14 order Order? REL Yes Order Virtual Prisma relation to Order.
@relation(fields: [orderId], references: [id])
15 sellerOrder SellerOrder? REL Yes SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
Relationship summary (4)
  • coupon -> Coupon couponId -> Coupon.id
  • buyer -> User buyerId -> User.id
  • order -> Order orderId -> Order.id
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
Indexes & constraints (4)
  • @@index([couponId, status])
  • @@index([buyerId, couponId])
  • @@index([orderId])
  • @@index([sellerOrderId])

Table 17 / Countries

17) Table Name: Country

Master table for active countries and sorting order.

country.prisma7 fields0 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 name String IDX No Sample Name Display name.
-
3 code String UQ No CODE123 Stores code.
@unique
4 isActive Boolean IDX No true Active/inactive flag.
@default(true)
5 sortOrder Int - No 0 Stores sort order.
@default(0)
6 createdAt DateTime - No now() Record creation timestamp.
@default(now())
7 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
Indexes & constraints (1)
  • @@index([isActive, name])

Table 18 / Engagement & Messaging

18) Table Name: SellerRating

Stores buyer ratings for sellers after order completion.

engagement.prisma14 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
4 sellerOrderId String UQFK No uuid Foreign key reference to SellerOrder.id.
@unique
5 stars Int - No 0 Stores stars.
-
6 feedback String? - Yes text Monetary/decimal value for feedback.
-
7 replyText String? - Yes text Stores reply text.
-
8 repliedAt DateTime? - Yes now() Date/time value for replied at.
-
9 status ReviewStatus IDX No PUBLISHED Current workflow or lifecycle status.
@default(PUBLISHED)
10 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
11 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
12 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
13 buyer User REL No User Virtual Prisma relation to User.
@relation("SellerRatingBuyer", fields: [buyerId], references: [id])
14 sellerOrder SellerOrder REL No SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
Relationship summary (3)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • buyer -> User buyerId -> User.id
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
Indexes & constraints (2)
  • @@index([sellerId, status, createdAt])
  • @@index([buyerId, createdAt])

Table 19 / Engagement & Messaging

19) Table Name: ProductReview

Stores buyer product reviews, moderation status and seller replies.

engagement.prisma23 fields6 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKIDX No uuid Foreign key reference to Product.id.
-
3 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
4 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
5 sellerOrderId String? FK Yes uuid Foreign key reference to SellerOrder.id.
-
6 orderItemId String? FKIDX Yes uuid Foreign key reference to OrderItem.id.
-
7 stars Int - No 0 Stores stars.
-
8 title String? - Yes text Display title.
-
9 comment String? - Yes text Stores comment.
-
10 mediaPublicIds String[] - No text Stores media public ids.
-
11 sellerReplyText String? - Yes text Stores seller reply text.
-
12 sellerRepliedAt DateTime? - Yes now() Date/time value for seller replied at.
-
13 isVerifiedPurchase Boolean - No false Boolean flag for is verified purchase.
@default(false)
14 status ReviewStatus IDX No PUBLISHED Current workflow or lifecycle status.
@default(PUBLISHED)
15 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
16 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
17 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
18 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
19 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
20 buyer User REL No User Virtual Prisma relation to User.
@relation("ProductReviewBuyer", fields: [buyerId], references: [id])
21 sellerOrder SellerOrder? REL Yes SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
22 orderItem OrderItem? REL Yes OrderItem Virtual Prisma relation to OrderItem.
@relation(fields: [orderItemId], references: [id])
23 helpfulVotes ReviewHelpfulVote[] REL No ReviewHelpfulVote[] Virtual Prisma back-relation containing related ReviewHelpfulVote records.
-
Relationship summary (6)
  • product -> Product productId -> Product.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • buyer -> User buyerId -> User.id
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • orderItem -> OrderItem orderItemId -> OrderItem.id
  • helpfulVotes -> ReviewHelpfulVote Back relation / one-to-many collection
Indexes & constraints (4)
  • @@index([productId, status, isDeleted])
  • @@index([sellerId, createdAt])
  • @@index([buyerId, productId])
  • @@index([orderItemId])

Table 20 / Engagement & Messaging

20) Table Name: ReviewHelpfulVote

Tracks helpful/not-helpful votes on product reviews.

engagement.prisma8 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 reviewId String FKUQ* No uuid Foreign key reference to ProductReview.id.
-
3 buyerId String FKUQ*IDX No uuid Foreign key reference to User.id.
-
4 helpful Boolean - No false Stores helpful.
-
5 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
6 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
7 review ProductReview REL No ProductReview Virtual Prisma relation to ProductReview.
@relation(fields: [reviewId], references: [id], onDelete: Cascade)
8 buyer User REL No User Virtual Prisma relation to User.
@relation("ReviewHelpfulVoteBuyer", fields: [buyerId], references: [id])
Relationship summary (2)
  • review -> ProductReview reviewId -> ProductReview.id
  • buyer -> User buyerId -> User.id
Indexes & constraints (2)
  • @@unique([reviewId, buyerId])
  • @@index([buyerId, createdAt])

Table 21 / Engagement & Messaging

21) Table Name: ProductQuestion

Stores buyer questions asked on product detail pages.

engagement.prisma16 fields4 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKIDX No uuid Foreign key reference to Product.id.
-
3 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
4 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
5 questionText String - No text Stores question text.
-
6 status QuestionStatus IDX No UNANSWERED Current workflow or lifecycle status.
@default(UNANSWERED)
7 isPublic Boolean IDX No false Boolean flag for is public.
@default(false)
8 reportedAt DateTime? - Yes now() Date/time value for reported at.
-
9 reportReason String? - Yes text Stores report reason.
-
10 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
11 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
12 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
13 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
14 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
15 buyer User REL No User Virtual Prisma relation to User.
@relation("ProductQuestionBuyer", fields: [buyerId], references: [id])
16 answer ProductAnswer? REL Yes ProductAnswer Virtual Prisma relation to ProductAnswer.
-
Relationship summary (4)
  • product -> Product productId -> Product.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • buyer -> User buyerId -> User.id
  • answer -> ProductAnswer Optional/one-to-one virtual relation
Indexes & constraints (3)
  • @@index([sellerId, status, createdAt])
  • @@index([productId, isPublic, createdAt])
  • @@index([buyerId, createdAt])

Table 22 / Engagement & Messaging

22) Table Name: ProductAnswer

Stores seller answers against product questions.

engagement.prisma8 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 questionId String UQFK No uuid Foreign key reference to ProductQuestion.id.
@unique
3 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
4 answerText String - No text Stores answer text.
-
5 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
6 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
7 question ProductQuestion REL No ProductQuestion Virtual Prisma relation to ProductQuestion.
@relation(fields: [questionId], references: [id], onDelete: Cascade)
8 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
Relationship summary (2)
  • question -> ProductQuestion questionId -> ProductQuestion.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
Indexes & constraints (1)
  • @@index([sellerId, createdAt])

Table 23 / Engagement & Messaging

23) Table Name: ConversationThread

Represents a chat thread between seller and buyer around a product/order context.

engagement.prisma17 fields4 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerOrderId String UQFK No uuid Foreign key reference to SellerOrder.id.
@unique
3 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
4 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
5 lastMessagePreview String? - Yes text Stores last message preview.
-
6 lastMessageAt DateTime? IDX Yes now() Date/time value for last message at.
-
7 hasUnreadBySeller Boolean - No false Stores has unread by seller.
@default(false)
8 hasUnreadByBuyer Boolean - No false Stores has unread by buyer.
@default(false)
9 unreadSellerCount Int - No 0 Stores unread seller count.
@default(0)
10 unreadBuyerCount Int - No 0 Stores unread buyer count.
@default(0)
11 isClosed Boolean - No false Boolean flag for is closed.
@default(false)
12 createdAt DateTime - No now() Record creation timestamp.
@default(now())
13 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
14 sellerOrder SellerOrder REL No SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
15 buyer User REL No User Virtual Prisma relation to User.
@relation("BuyerConversationThreads", fields: [buyerId], references: [id])
16 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
17 messages Message[] REL No Message[] Virtual Prisma back-relation containing related Message records.
-
Relationship summary (4)
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • buyer -> User buyerId -> User.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • messages -> Message Back relation / one-to-many collection
Indexes & constraints (2)
  • @@index([sellerId, lastMessageAt])
  • @@index([buyerId, lastMessageAt])

Table 24 / Engagement & Messaging

24) Table Name: Message

Stores individual chat messages, including text or image messages.

engagement.prisma14 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 threadId String FKIDX No uuid Foreign key reference to ConversationThread.id.
-
3 senderId String FKIDX No uuid Foreign key reference to User.id.
-
4 receiverId String FKIDX No uuid Foreign key reference to User.id.
-
5 messageType MessageType - No TEXT Enum value from MessageType (TEXT, IMAGE).
@default(TEXT)
6 text String? - Yes text Stores text.
-
7 imagePublicId String? - Yes uuid Identifier reference for image public.
-
8 cloudinaryUrl String? - Yes https://... Stores cloudinary url.
-
9 readAt DateTime? IDX Yes now() Date/time value for read at.
-
10 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
11 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
12 thread ConversationThread REL No ConversationThread Virtual Prisma relation to ConversationThread.
@relation(fields: [threadId], references: [id], onDelete: Cascade)
13 sender User REL No User Virtual Prisma relation to User.
@relation("MessageSender", fields: [senderId], references: [id])
14 receiver User REL No User Virtual Prisma relation to User.
@relation("MessageReceiver", fields: [receiverId], references: [id])
Relationship summary (3)
  • thread -> ConversationThread threadId -> ConversationThread.id
  • sender -> User senderId -> User.id
  • receiver -> User receiverId -> User.id
Indexes & constraints (3)
  • @@index([threadId, createdAt])
  • @@index([senderId, createdAt])
  • @@index([receiverId, readAt])

Table 25 / Notifications

25) Table Name: Notification

Stores in-app notifications for account, order, payout and engagement events.

notification.prisma9 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 recipientId String FKIDX No uuid Foreign key reference to User.id.
-
3 type NotificationType IDX No ORDER_CREATED Enum value from NotificationType (ORDER_CREATED, ORDER_STATUS_CHANGED, WALLET_CREDITED, PAYOUT_SUCCEEDED, PAYOUT_FAILED, BRAND_APPROVED...).
-
4 title String - No text Display title.
-
5 body String? - Yes text Stores body.
-
6 data Json? - Yes {} Flexible JSON payload for notification/event data.
-
7 readAt DateTime? IDX Yes now() Date/time value for read at.
-
8 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
9 recipient User REL No User Virtual Prisma relation to User.
@relation("NotificationRecipient", fields: [recipientId], references: [id])
Relationship summary (1)
  • recipient -> User recipientId -> User.id
Indexes & constraints (2)
  • @@index([recipientId, readAt, createdAt])
  • @@index([type, createdAt])

Table 26 / Notifications

26) Table Name: ProcessedWebhook

Keeps webhook event ids to make external provider callbacks idempotent.

notification.prisma7 fields0 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 eventId String UQ No uuid Identifier reference for event.
@unique
3 source String IDX No text Stores source.
-
4 eventType String - No text Stores event type.
-
5 entityId String? - Yes uuid Identifier reference for entity.
-
6 payload Json? - Yes {} Raw or structured external provider/webhook payload.
-
7 processedAt DateTime IDX No now() Date/time value for processed at.
@default(now())
Indexes & constraints (1)
  • @@index([source, processedAt])

Table 27 / Orders & Returns

27) Table Name: Order

Parent buyer order with payment, totals, addresses and coupon discount summary.

order.prisma23 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 orderNumber String UQ No text Stores order number.
@unique
3 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
4 buyerNameSnapshot String? - Yes Sample Name Stores buyer name snapshot.
-
5 paymentStatus PaymentStatus IDX No PENDING Enum value from PaymentStatus (PENDING, CAPTURED, FAILED, REFUND_INITIATED, REFUNDED, PARTIALLY_REFUNDED).
@default(PENDING)
6 razorpayOrderId String? UQ* Yes uuid Identifier reference for razorpay order.
-
7 razorpayPaymentId String? - Yes uuid Identifier reference for razorpay payment.
-
8 paymentFailureReason String? - Yes text Stores payment failure reason.
-
9 paidAt DateTime? - Yes now() Date/time value for paid at.
-
10 currency String - No "INR" Currency code for monetary values.
@default("INR")
11 subtotalAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for subtotal amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
12 discountAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for discount amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
13 shippingAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for shipping amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
14 taxAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for tax amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
15 payableAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for payable amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
16 shippingAddress Json? - Yes {} Stores shipping address.
-
17 billingAddress Json? - Yes {} Stores billing address.
-
18 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
19 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
20 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
21 buyer User REL No User Virtual Prisma relation to User.
@relation("BuyerOrders", fields: [buyerId], references: [id])
22 sellerOrders SellerOrder[] REL No SellerOrder[] Virtual Prisma back-relation containing related SellerOrder records.
-
23 couponRedemptions CouponRedemption[] REL No CouponRedemption[] Virtual Prisma back-relation containing related CouponRedemption records.
-
Relationship summary (3)
  • buyer -> User buyerId -> User.id
  • sellerOrders -> SellerOrder Back relation / one-to-many collection
  • couponRedemptions -> CouponRedemption Back relation / one-to-many collection
Indexes & constraints (3)
  • @@unique([razorpayOrderId])
  • @@index([buyerId, createdAt])
  • @@index([paymentStatus, createdAt])

Table 28 / Orders & Returns

28) Table Name: SellerOrder

Seller-level split of an order, including fulfillment, commission and wallet settlement state.

order.prisma41 fields11 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 orderId String FKUQ* No uuid Foreign key reference to Order.id.
-
3 sellerId String FKUQ*IDX No uuid Foreign key reference to SellerProfile.id.
-
4 sellerOrderNumber String UQ No text Stores seller order number.
@unique
5 status OrderStatus IDX No PENDING_SELLER_APPROVAL Current workflow or lifecycle status.
@default(PENDING_SELLER_APPROVAL)
6 rejectionReason String? - Yes text Stores rejection reason.
-
7 autoAcceptDeadlineAt DateTime? - Yes now() Date/time value for auto accept deadline at.
-
8 trackingNumber String? - Yes text Stores tracking number.
-
9 courierName String? - Yes Sample Name Stores courier name.
-
10 courierTrackingUrl String? - Yes https://... Stores courier tracking url.
-
11 sellerSubtotal DecimalDecimal(14, 2) - No 0 Monetary/decimal value for seller subtotal.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
12 sellerDiscount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for seller discount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
13 platformFeeRate DecimalDecimal(5, 2) - No 0 Monetary/decimal value for platform fee rate.
@default(0) @db.Decimal(5, 2) | DB: Decimal(5, 2)
14 platformFeeAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for platform fee amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
15 sellerProceeds DecimalDecimal(14, 2) - No 0 Monetary/decimal value for seller proceeds.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
16 acceptedAt DateTime? - Yes now() Date/time value for accepted at.
-
17 autoAcceptedAt DateTime? - Yes now() Date/time value for auto accepted at.
-
18 shippedAt DateTime? - Yes now() Date/time value for shipped at.
-
19 outForDeliveryAt DateTime? - Yes now() Date/time value for out for delivery at.
-
20 deliveredAt DateTime? - Yes now() Date/time value for delivered at.
-
21 closedAt DateTime? - Yes now() Date/time value for closed at.
-
22 cancelledAt DateTime? - Yes now() Date/time value for cancelled at.
-
23 refundId String? - Yes uuid Identifier reference for refund.
-
24 refundStatus PaymentStatus? - Yes PENDING Enum value from PaymentStatus (PENDING, CAPTURED, FAILED, REFUND_INITIATED, REFUNDED, PARTIALLY_REFUNDED).
-
25 refundInitiatedAt DateTime? - Yes now() Date/time value for refund initiated at.
-
26 refundCompletedAt DateTime? - Yes now() Date/time value for refund completed at.
-
27 creditedAt DateTime? - Yes now() Date/time value for credited at.
-
28 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
29 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
30 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
31 order Order REL No Order Virtual Prisma relation to Order.
@relation(fields: [orderId], references: [id])
32 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
33 items OrderItem[] REL No OrderItem[] Virtual Prisma back-relation containing related OrderItem records.
-
34 statusHistory OrderStatusHistory[] REL No OrderStatusHistory[] Virtual Prisma back-relation containing related OrderStatusHistory records.
-
35 returnRequests ReturnRequest[] REL No ReturnRequest[] Virtual Prisma back-relation containing related ReturnRequest records.
-
36 walletTransactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
37 walletDebts SellerWalletDebt[] REL No SellerWalletDebt[] Virtual Prisma back-relation containing related SellerWalletDebt records.
-
38 sellerRating SellerRating? REL Yes SellerRating Virtual Prisma relation to SellerRating.
-
39 productReviews ProductReview[] REL No ProductReview[] Virtual Prisma back-relation containing related ProductReview records.
-
40 conversationThread ConversationThread? REL Yes ConversationThread Virtual Prisma relation to ConversationThread.
-
41 couponRedemptions CouponRedemption[] REL No CouponRedemption[] Virtual Prisma back-relation containing related CouponRedemption records.
-
Relationship summary (11)
  • order -> Order orderId -> Order.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • items -> OrderItem Back relation / one-to-many collection
  • statusHistory -> OrderStatusHistory Back relation / one-to-many collection
  • returnRequests -> ReturnRequest Back relation / one-to-many collection
  • walletTransactions -> WalletTransaction Back relation / one-to-many collection
  • walletDebts -> SellerWalletDebt Back relation / one-to-many collection
  • sellerRating -> SellerRating Optional/one-to-one virtual relation
  • productReviews -> ProductReview Back relation / one-to-many collection
  • conversationThread -> ConversationThread Optional/one-to-one virtual relation
  • couponRedemptions -> CouponRedemption Back relation / one-to-many collection
Indexes & constraints (3)
  • @@unique([orderId, sellerId])
  • @@index([sellerId, status, createdAt])
  • @@index([status, createdAt])

Table 29 / Orders & Returns

29) Table Name: OrderItem

Line items inside seller orders, with product/variant snapshots, tax, discount and return flags.

order.prisma22 fields6 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerOrderId String FKIDX No uuid Foreign key reference to SellerOrder.id.
-
3 productId String FKIDX No uuid Foreign key reference to Product.id.
-
4 variantId String? FKIDX Yes uuid Foreign key reference to ProductVariant.id.
-
5 productName String - No Sample Name Stores product name.
-
6 sku String - No text Seller stock keeping unit for inventory tracking.
-
7 variantLabel String? - Yes text Stores variant label.
-
8 imagePublicId String? - Yes uuid Identifier reference for image public.
-
9 unitPrice DecimalDecimal(12, 2) - No 0.00 Monetary/decimal value for unit price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
10 mrp DecimalDecimal(12, 2) - No 0.00 Maximum retail price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
11 quantity Int - No 0 Quantity/stock count.
-
12 gstRate Decimal?Decimal(5, 2) - Yes 0.00 Monetary/decimal value for gst rate.
@db.Decimal(5, 2) | DB: Decimal(5, 2)
13 taxAmount DecimalDecimal(12, 2) - No 0 Monetary/decimal value for tax amount.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
14 discountAmount DecimalDecimal(12, 2) - No 0 Monetary/decimal value for discount amount.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
15 lineTotal DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for line total.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
16 createdAt DateTime - No now() Record creation timestamp.
@default(now())
17 sellerOrder SellerOrder REL No SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id], onDelete: Cascade)
18 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
19 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
20 returnRequests ReturnRequest[] REL No ReturnRequest[] Virtual Prisma back-relation containing related ReturnRequest records.
-
21 productReviews ProductReview[] REL No ProductReview[] Virtual Prisma back-relation containing related ProductReview records.
-
22 walletTransactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
Relationship summary (6)
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
  • returnRequests -> ReturnRequest Back relation / one-to-many collection
  • productReviews -> ProductReview Back relation / one-to-many collection
  • walletTransactions -> WalletTransaction Back relation / one-to-many collection
Indexes & constraints (3)
  • @@index([sellerOrderId])
  • @@index([productId])
  • @@index([variantId])

Table 30 / Orders & Returns

30) Table Name: OrderStatusHistory

Timeline table for order status changes with actor and optional notes.

order.prisma9 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerOrderId String FKIDX No uuid Foreign key reference to SellerOrder.id.
-
3 fromStatus OrderStatus? - Yes PENDING_SELLER_APPROVAL Enum value from OrderStatus (PENDING_SELLER_APPROVAL, PROCESSING, SHIPPED, OUT_FOR_DELIVERY, DELIVERED, RETURN_INITIATED...).
-
4 toStatus OrderStatus IDX No PENDING_SELLER_APPROVAL Enum value from OrderStatus (PENDING_SELLER_APPROVAL, PROCESSING, SHIPPED, OUT_FOR_DELIVERY, DELIVERED, RETURN_INITIATED...).
-
5 actorUserId String? - Yes uuid Identifier reference for actor user.
-
6 note String? - Yes text Stores note.
-
7 metadata Json? - Yes {} Flexible JSON metadata for extra provider or audit information.
-
8 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
9 sellerOrder SellerOrder REL No SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id], onDelete: Cascade)
Relationship summary (1)
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
Indexes & constraints (2)
  • @@index([sellerOrderId, createdAt])
  • @@index([toStatus, createdAt])

Table 31 / Orders & Returns

31) Table Name: ReturnRequest

Stores return/refund workflow, pickup, inspection, refund and wallet recovery details.

order.prisma26 fields5 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerOrderId String FKIDX No uuid Foreign key reference to SellerOrder.id.
-
3 orderItemId String? FK Yes uuid Foreign key reference to OrderItem.id.
-
4 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
5 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
6 status ReturnRequestStatus IDX No REQUESTED Current workflow or lifecycle status.
@default(REQUESTED)
7 reason String - No text Stores reason.
-
8 reasonDetail String? - Yes text Stores reason detail.
-
9 imageUrls String[] - No [] Stores image urls.
@default([])
10 returnTrackingNumber String? - Yes text Stores return tracking number.
-
11 returnCourierName String? - Yes Sample Name Stores return courier name.
-
12 refundAmount Decimal?Decimal(12, 2) - Yes 0.00 Monetary/decimal value for refund amount.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
13 razorpayRefundId String? - Yes uuid Identifier reference for razorpay refund.
-
14 adminNote String? - Yes text Stores admin note.
-
15 rejectionReason String? - Yes text Stores rejection reason.
-
16 investigationEndsAt DateTime? - Yes now() Date/time value for investigation ends at.
-
17 isDeleted Boolean - No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
18 requestedAt DateTime IDX No now() Date/time value for requested at.
@default(now())
19 resolvedAt DateTime? - Yes now() Date/time value for resolved at.
-
20 createdAt DateTime - No now() Record creation timestamp.
@default(now())
21 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
22 sellerOrder SellerOrder REL No SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
23 orderItem OrderItem? REL Yes OrderItem Virtual Prisma relation to OrderItem.
@relation(fields: [orderItemId], references: [id])
24 buyer User REL No User Virtual Prisma relation to User.
@relation("ReturnRequestBuyer", fields: [buyerId], references: [id])
25 seller SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
26 walletDebts SellerWalletDebt[] REL No SellerWalletDebt[] Virtual Prisma back-relation containing related SellerWalletDebt records.
-
Relationship summary (5)
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • orderItem -> OrderItem orderItemId -> OrderItem.id
  • buyer -> User buyerId -> User.id
  • seller -> SellerProfile sellerId -> SellerProfile.id
  • walletDebts -> SellerWalletDebt Back relation / one-to-many collection
Indexes & constraints (3)
  • @@index([sellerId, status, requestedAt])
  • @@index([buyerId, requestedAt])
  • @@index([sellerOrderId])

Table 32 / Catalog & Inventory

32) Table Name: Category

Hierarchical product category tree with seller-proposed category support.

product.prisma20 fields7 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 parentId String? FKIDX Yes uuid Foreign key reference to Category.id.
-
3 name String - No Sample Name Display name.
-
4 slug String UQ No sample-slug SEO-friendly unique URL identifier.
@unique
5 description String? - Yes text Longer display/SEO description.
-
6 status CategoryStatus IDX No ACTIVE Current workflow or lifecycle status.
@default(ACTIVE)
7 isAdminManaged Boolean - No true Boolean flag for is admin managed.
@default(true)
8 proposedBySellerId String? FKIDX Yes uuid Foreign key reference to SellerProfile.id.
-
9 rejectMessage String? - Yes text Stores reject message.
-
10 sortOrder Int - No 0 Stores sort order.
@default(0)
11 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
12 createdAt DateTime - No now() Record creation timestamp.
@default(now())
13 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
14 parent Category? REL Yes Category Virtual Prisma relation to Category.
@relation("CategoryTree", fields: [parentId], references: [id])
15 children Category[] REL No Category[] Virtual Prisma back-relation containing related Category records.
@relation("CategoryTree")
16 proposedBySeller SellerProfile? REL Yes SellerProfile Virtual Prisma relation to SellerProfile.
@relation("CategoryProposedBySeller", fields: [proposedBySellerId], references: [id])
17 products Product[] REL No Product[] Virtual Prisma back-relation containing related Product records.
-
18 tradeMarks TradMark[] REL No TradMark[] Virtual Prisma back-relation containing related TradMark records.
-
19 hsnCodes HsnCode[] REL No HsnCode[] Virtual Prisma back-relation containing related HsnCode records.
-
20 coupons Coupon[] REL No Coupon[] Virtual Prisma back-relation containing related Coupon records.
-
Relationship summary (7)
  • parent -> Category parentId -> Category.id
  • children -> Category Back relation / one-to-many collection
  • proposedBySeller -> SellerProfile proposedBySellerId -> SellerProfile.id
  • products -> Product Back relation / one-to-many collection
  • tradeMarks -> TradMark Back relation / one-to-many collection
  • hsnCodes -> HsnCode Back relation / one-to-many collection
  • coupons -> Coupon Back relation / one-to-many collection
Indexes & constraints (2)
  • @@index([parentId, status, isDeleted])
  • @@index([proposedBySellerId, status])

Table 33 / Catalog & Inventory

33) Table Name: HsnCode

Stores HSN/GST code data attached to categories and products.

product.prisma10 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 code String UQ No CODE123 Stores code.
@unique
3 description String? - Yes text Longer display/SEO description.
-
4 gstRate DecimalDecimal(5, 2) - No 0.00 Monetary/decimal value for gst rate.
@db.Decimal(5, 2) | DB: Decimal(5, 2)
5 categoryId String? FKIDX Yes uuid Foreign key reference to Category.id.
-
6 isActive Boolean IDX No true Active/inactive flag.
@default(true)
7 createdAt DateTime - No now() Record creation timestamp.
@default(now())
8 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
9 category Category? REL Yes Category Virtual Prisma relation to Category.
@relation(fields: [categoryId], references: [id])
10 products Product[] REL No Product[] Virtual Prisma back-relation containing related Product records.
-
Relationship summary (2)
  • category -> Category categoryId -> Category.id
  • products -> Product Back relation / one-to-many collection
Indexes & constraints (1)
  • @@index([categoryId, isActive])

Table 34 / Catalog & Inventory

34) Table Name: Product

Core product listing table with seller, category, pricing, SEO, delivery and status metadata.

product.prisma56 fields18 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 categoryId String FKIDX No uuid Foreign key reference to Category.id.
-
4 tradeMarkId String? FKIDX Yes uuid Foreign key reference to TradMark.id.
-
5 hsnCodeId String? FKIDX Yes uuid Foreign key reference to HsnCode.id.
-
6 itemName String - No Sample Name Stores item name.
-
7 slug String UQ No sample-slug SEO-friendly unique URL identifier.
@unique
8 descriptionHtml String - No text Stores description html.
-
9 bulletPoints String[] - No text Stores bullet points.
-
10 targetGender TargetGender - No MALE Enum value from TargetGender (MALE, FEMALE, UNISEX).
-
11 itemCondition ProductCondition - No NEW Enum value from ProductCondition (NEW, REPLACE, REUSE).
@default(NEW)
12 material String? - Yes text Stores material.
-
13 manufacturer String? - Yes text Stores manufacturer.
-
14 countryOfOrigin String? - Yes text Stores country of origin.
-
15 numberOfItemsPerOrder Int - No 1 Stores number of items per order.
@default(1)
16 weightKg Decimal?Decimal(10, 3) - Yes 0.00 Monetary/decimal value for weight kg.
@db.Decimal(10, 3) | DB: Decimal(10, 3)
17 lengthCm Decimal?Decimal(10, 2) - Yes 0.00 Monetary/decimal value for length cm.
@db.Decimal(10, 2) | DB: Decimal(10, 2)
18 widthCm Decimal?Decimal(10, 2) - Yes 0.00 Monetary/decimal value for width cm.
@db.Decimal(10, 2) | DB: Decimal(10, 2)
19 heightCm Decimal?Decimal(10, 2) - Yes 0.00 Monetary/decimal value for height cm.
@db.Decimal(10, 2) | DB: Decimal(10, 2)
20 sku String UQ No text Seller stock keeping unit for inventory tracking.
@unique
21 status ProductStatus IDX No DRAFT Current workflow or lifecycle status.
@default(DRAFT)
22 actualStock Int - No 0 Stores actual stock.
@default(0)
23 effectiveStock Int - No 0 Stores effective stock.
@default(0)
24 price DecimalDecimal(12, 2) - No 0.00 Price amount.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
25 mrp DecimalDecimal(12, 2) - No 0.00 Maximum retail price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
26 gstRateSnapshot Decimal?Decimal(5, 2) - Yes 0.00 Monetary/decimal value for gst rate snapshot.
@db.Decimal(5, 2) | DB: Decimal(5, 2)
27 seoTitle String? - Yes text Stores seo title.
-
28 seoDescription String? - Yes text Stores seo description.
-
29 seoKeywords String[] - No text Stores seo keywords.
-
30 videoPublicId String? - Yes uuid Identifier reference for video public.
-
31 videoUrl String? - Yes https://... Stores video url.
-
32 viewCount Int - No 0 Stores view count.
@default(0)
33 unitsSold Int - No 0 Stores units sold.
@default(0)
34 salesAmount DecimalDecimal(14, 2) - No 0 Monetary/decimal value for sales amount.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
35 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
36 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
37 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
38 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
39 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
40 category Category REL No Category Virtual Prisma relation to Category.
@relation(fields: [categoryId], references: [id])
41 tradeMark TradMark? REL Yes TradMark Virtual Prisma relation to TradMark.
@relation(fields: [tradeMarkId], references: [id])
42 hsnCode HsnCode? REL Yes HsnCode Virtual Prisma relation to HsnCode.
@relation(fields: [hsnCodeId], references: [id])
43 variants ProductVariant[] REL No ProductVariant[] Virtual Prisma back-relation containing related ProductVariant records.
-
44 images ProductImage[] REL No ProductImage[] Virtual Prisma back-relation containing related ProductImage records.
-
45 aplusContents AplusContent[] REL No AplusContent[] Virtual Prisma back-relation containing related AplusContent records.
-
46 views ProductView[] REL No ProductView[] Virtual Prisma back-relation containing related ProductView records.
-
47 inventoryTransactions InventoryTransaction[] REL No InventoryTransaction[] Virtual Prisma back-relation containing related InventoryTransaction records.
-
48 stockBackAlerts StockBackAlert[] REL No StockBackAlert[] Virtual Prisma back-relation containing related StockBackAlert records.
-
49 cartItems CartItem[] REL No CartItem[] Virtual Prisma back-relation containing related CartItem records.
-
50 wishlistItems WishlistItem[] REL No WishlistItem[] Virtual Prisma back-relation containing related WishlistItem records.
-
51 orderItems OrderItem[] REL No OrderItem[] Virtual Prisma back-relation containing related OrderItem records.
-
52 dealProducts DealProduct[] REL No DealProduct[] Virtual Prisma back-relation containing related DealProduct records.
-
53 couponProducts CouponProduct[] REL No CouponProduct[] Virtual Prisma back-relation containing related CouponProduct records.
-
54 couponClips CouponClip[] REL No CouponClip[] Virtual Prisma back-relation containing related CouponClip records.
-
55 productReviews ProductReview[] REL No ProductReview[] Virtual Prisma back-relation containing related ProductReview records.
-
56 questions ProductQuestion[] REL No ProductQuestion[] Virtual Prisma back-relation containing related ProductQuestion records.
-
Relationship summary (18)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • category -> Category categoryId -> Category.id
  • tradeMark -> TradMark tradeMarkId -> TradMark.id
  • hsnCode -> HsnCode hsnCodeId -> HsnCode.id
  • variants -> ProductVariant Back relation / one-to-many collection
  • images -> ProductImage Back relation / one-to-many collection
  • aplusContents -> AplusContent Back relation / one-to-many collection
  • views -> ProductView Back relation / one-to-many collection
  • inventoryTransactions -> InventoryTransaction Back relation / one-to-many collection
  • stockBackAlerts -> StockBackAlert Back relation / one-to-many collection
  • cartItems -> CartItem Back relation / one-to-many collection
  • wishlistItems -> WishlistItem Back relation / one-to-many collection
  • orderItems -> OrderItem Back relation / one-to-many collection
  • dealProducts -> DealProduct Back relation / one-to-many collection
  • couponProducts -> CouponProduct Back relation / one-to-many collection
  • couponClips -> CouponClip Back relation / one-to-many collection
  • productReviews -> ProductReview Back relation / one-to-many collection
  • questions -> ProductQuestion Back relation / one-to-many collection
Indexes & constraints (5)
  • @@index([sellerId, status, isDeleted])
  • @@index([categoryId, status, isDeleted])
  • @@index([tradeMarkId])
  • @@index([hsnCodeId])
  • @@index([createdAt])

Table 35 / Catalog & Inventory

35) Table Name: ProductVariant

Stores SKU-level variation data such as color, size, price and stock.

product.prisma21 fields7 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKIDX No uuid Foreign key reference to Product.id.
-
3 sku String? UQ Yes text Seller stock keeping unit for inventory tracking.
@unique
4 size String? - Yes text Stores size.
-
5 color String? - Yes text Stores color.
-
6 material String? - Yes text Stores material.
-
7 actualStock Int - No 0 Stores actual stock.
@default(0)
8 effectiveStock Int - No 0 Stores effective stock.
@default(0)
9 price DecimalDecimal(12, 2) - No 0.00 Price amount.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
10 mrp DecimalDecimal(12, 2) - No 0.00 Maximum retail price.
@db.Decimal(12, 2) | DB: Decimal(12, 2)
11 isDefault Boolean - No false Marks this record as the default option.
@default(false)
12 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
13 createdAt DateTime - No now() Record creation timestamp.
@default(now())
14 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
15 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id], onDelete: Cascade)
16 orderItems OrderItem[] REL No OrderItem[] Virtual Prisma back-relation containing related OrderItem records.
-
17 dealProducts DealProduct[] REL No DealProduct[] Virtual Prisma back-relation containing related DealProduct records.
-
18 inventoryTransactions InventoryTransaction[] REL No InventoryTransaction[] Virtual Prisma back-relation containing related InventoryTransaction records.
-
19 stockBackAlerts StockBackAlert[] REL No StockBackAlert[] Virtual Prisma back-relation containing related StockBackAlert records.
-
20 cartItems CartItem[] REL No CartItem[] Virtual Prisma back-relation containing related CartItem records.
-
21 wishlistItems WishlistItem[] REL No WishlistItem[] Virtual Prisma back-relation containing related WishlistItem records.
-
Relationship summary (7)
  • product -> Product productId -> Product.id
  • orderItems -> OrderItem Back relation / one-to-many collection
  • dealProducts -> DealProduct Back relation / one-to-many collection
  • inventoryTransactions -> InventoryTransaction Back relation / one-to-many collection
  • stockBackAlerts -> StockBackAlert Back relation / one-to-many collection
  • cartItems -> CartItem Back relation / one-to-many collection
  • wishlistItems -> WishlistItem Back relation / one-to-many collection
Indexes & constraints (1)
  • @@index([productId, isDeleted])

Table 36 / Catalog & Inventory

36) Table Name: ProductImage

Stores product/variant images, Cloudinary public ids, ordering and primary image flag.

product.prisma10 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKUQ*IDX No uuid Foreign key reference to Product.id.
-
3 publicId String UQ* No uuid Identifier reference for public.
-
4 url String? - Yes https://... Stores url.
-
5 altText String? - Yes text Stores alt text.
-
6 sortOrder Int UQ* No 0 Stores sort order.
-
7 isMain Boolean IDX No false Boolean flag for is main.
@default(false)
8 createdAt DateTime - No now() Record creation timestamp.
@default(now())
9 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
10 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id], onDelete: Cascade)
Relationship summary (1)
  • product -> Product productId -> Product.id
Indexes & constraints (3)
  • @@unique([productId, publicId])
  • @@unique([productId, sortOrder])
  • @@index([productId, isMain])

Table 37 / Catalog & Inventory

37) Table Name: ProductView

Tracks buyer/product view analytics for engagement and reporting.

product.prisma11 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKIDX No uuid Foreign key reference to Product.id.
-
3 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
4 buyerId String? FKIDX Yes uuid Foreign key reference to User.id.
-
5 sessionId String? - Yes uuid Identifier reference for session.
-
6 ipHash String? - Yes text Security-sensitive stored value; use hashing/encryption as indicated by the field name.
-
7 source String? - Yes text Stores source.
-
8 viewedAt DateTime IDX No now() Date/time value for viewed at.
@default(now())
9 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id], onDelete: Cascade)
10 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
11 buyer User? REL Yes User Virtual Prisma relation to User.
@relation("ProductViewBuyer", fields: [buyerId], references: [id])
Relationship summary (3)
  • product -> Product productId -> Product.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • buyer -> User buyerId -> User.id
Indexes & constraints (3)
  • @@index([productId, viewedAt])
  • @@index([sellerId, viewedAt])
  • @@index([buyerId, viewedAt])

Table 38 / Catalog & Inventory

38) Table Name: AplusContent

Stores seller A+ content page status and language for product detail enhancement.

product.prisma13 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 productId String FKUQ* No uuid Foreign key reference to Product.id.
-
4 contentName String - No Sample Name Stores content name.
-
5 language AplusContentLanguage UQ* No EN Enum value from AplusContentLanguage (EN, HI, GU).
@default(EN)
6 status AplusContentStatus IDX No DRAFT Current workflow or lifecycle status.
@default(DRAFT)
7 publishedAt DateTime? - Yes now() Date/time value for published at.
-
8 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
9 createdAt DateTime - No now() Record creation timestamp.
@default(now())
10 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
11 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
12 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id], onDelete: Cascade)
13 blocks AplusContentBlock[] REL No AplusContentBlock[] Virtual Prisma back-relation containing related AplusContentBlock records.
-
Relationship summary (3)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • product -> Product productId -> Product.id
  • blocks -> AplusContentBlock Back relation / one-to-many collection
Indexes & constraints (2)
  • @@unique([productId, language])
  • @@index([sellerId, status, isDeleted])

Table 39 / Catalog & Inventory

39) Table Name: AplusContentBlock

Stores individual A+ content blocks such as image, heading, text or video.

product.prisma13 fields1 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 contentId String FKUQ* No uuid Foreign key reference to AplusContent.id.
-
3 blockType AplusBlockType - No IMAGE Enum value from AplusBlockType (IMAGE, HEADING, TEXT, VIDEO).
-
4 sortOrder Int UQ* No 0 Stores sort order.
-
5 headingLevel Int? - Yes 0 Stores heading level.
-
6 textHtml String? - Yes text Stores text html.
-
7 mediaPublicId String? - Yes uuid Identifier reference for media public.
-
8 mediaUrl String? - Yes https://... Stores media url.
-
9 caption String? - Yes text Stores caption.
-
10 layout String? - Yes text Stores layout.
-
11 createdAt DateTime - No now() Record creation timestamp.
@default(now())
12 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
13 content AplusContent REL No AplusContent Virtual Prisma relation to AplusContent.
@relation(fields: [contentId], references: [id], onDelete: Cascade)
Relationship summary (1)
  • content -> AplusContent contentId -> AplusContent.id
Indexes & constraints (1)
  • @@unique([contentId, sortOrder])

Table 40 / Catalog & Inventory

40) Table Name: StockBackAlert

Stores buyer requests to be notified when a product/variant comes back in stock.

product.prisma12 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 productId String FKIDX No uuid Foreign key reference to Product.id.
-
3 variantId String? FKIDX Yes uuid Foreign key reference to ProductVariant.id.
-
4 buyerId String FKIDX No uuid Foreign key reference to User.id.
-
5 notified Boolean IDX No false Stores notified.
@default(false)
6 notifiedAt DateTime? - Yes now() Date/time value for notified at.
-
7 isDeleted Boolean IDX No false Soft-delete flag. Deleted records remain in the database for audit/history.
@default(false)
8 deletedAt DateTime? - Yes now() Timestamp when the record was soft-deleted.
-
9 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
10 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id], onDelete: Cascade)
11 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
12 buyer User REL No User Virtual Prisma relation to User.
@relation("StockBackAlertBuyer", fields: [buyerId], references: [id])
Relationship summary (3)
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
  • buyer -> User buyerId -> User.id
Indexes & constraints (3)
  • @@index([productId, notified, isDeleted])
  • @@index([buyerId, createdAt])
  • @@index([buyerId, productId, variantId, notified, isDeleted])

Table 41 / Catalog & Inventory

41) Table Name: InventoryTransaction

Stores immutable inventory movement history for adjustments, reservations, fulfillment and returns.

product.prisma15 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 productId String FKIDX No uuid Foreign key reference to Product.id.
-
4 variantId String? FKIDX Yes uuid Foreign key reference to ProductVariant.id.
-
5 type InventoryTransactionType - No STOCK_ADJUSTMENT Enum value from InventoryTransactionType (STOCK_ADJUSTMENT, ORDER_RESERVED, ORDER_RELEASED, ORDER_FULFILLED, RETURN_RESTOCK, PAUSE_LISTING...).
-
6 quantityDelta Int - No 0 Stores quantity delta.
-
7 actualStockAfter Int - No 0 Stores actual stock after.
-
8 effectiveStockAfter Int - No 0 Stores effective stock after.
-
9 reason String? - Yes text Stores reason.
-
10 referenceType String? IDX Yes text Stores reference type.
-
11 referenceId String? IDX Yes uuid Identifier reference for reference.
-
12 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
13 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
14 product Product REL No Product Virtual Prisma relation to Product.
@relation(fields: [productId], references: [id])
15 variant ProductVariant? REL Yes ProductVariant Virtual Prisma relation to ProductVariant.
@relation(fields: [variantId], references: [id])
Relationship summary (3)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • product -> Product productId -> Product.id
  • variant -> ProductVariant variantId -> ProductVariant.id
Indexes & constraints (4)
  • @@index([sellerId, createdAt])
  • @@index([productId, createdAt])
  • @@index([variantId, createdAt])
  • @@index([referenceType, referenceId])

Table 42 / Seller, Wallet & Payouts

42) Table Name: SellerProfile

Extends a user with seller KYC, bank verification, rating and business profile data.

seller.prisma38 fields21 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 userId String UQFK No uuid Foreign key reference to User.id.
@unique
3 shopAddress String? - Yes text Stores shop address.
-
4 bankVerificationStatus BankVerificationStatus - No PENDING Enum value from BankVerificationStatus (PENDING, KYC_VERIFIED, CONTACT_CREATED, FUND_ACCOUNT_CREATED, VALIDATION_INITIATED, REVERSE_PENNY_DROP_PENDING...).
@default(PENDING)
5 kycRegisterName String? - Yes Sample Name Stores kyc register name.
-
6 upiRegisterName String? - Yes Sample Name Stores upi register name.
-
7 bankRegisterName String? - Yes Sample Name Stores bank register name.
-
8 cashfreeBeneficiaryId String? - Yes uuid Identifier reference for cashfree beneficiary.
-
9 technicalErrorMessage String? - Yes text Stores technical error message.
-
10 verificationFeeOwedPaise Int - No 0 Monetary/decimal value for verification fee owed paise.
@default(0)
11 encryptedPanNumber String? - Yes text Security-sensitive stored value; use hashing/encryption as indicated by the field name.
-
12 panNumberHash String? UQ Yes text Security-sensitive stored value; use hashing/encryption as indicated by the field name.
@unique
13 averageRating DecimalDecimal(3, 2) - No 0 Monetary/decimal value for average rating.
@default(0) @db.Decimal(3, 2) | DB: Decimal(3, 2)
14 ratingCount Int - No 0 Stores rating count.
@default(0)
15 reviewCount Int - No 0 Stores review count.
@default(0)
16 createdAt DateTime - No now() Record creation timestamp.
@default(now())
17 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
18 user User REL No User Virtual Prisma relation to User.
@relation(fields: [userId], references: [id])
19 bankAccountDetails SellerBankAccountDetails? REL Yes SellerBankAccountDetails Virtual Prisma relation to SellerBankAccountDetails.
-
20 bankVerificationAttempts SellerBankVerificationAttempt[] REL No SellerBankVerificationAttempt[] Virtual Prisma back-relation containing related SellerBankVerificationAttempt records.
-
21 digitalWallet SellerDigitalWallet? REL Yes SellerDigitalWallet Virtual Prisma relation to SellerDigitalWallet.
-
22 products Product[] REL No Product[] Virtual Prisma back-relation containing related Product records.
-
23 productViews ProductView[] REL No ProductView[] Virtual Prisma back-relation containing related ProductView records.
-
24 proposedCategories Category[] REL No Category[] Virtual Prisma back-relation containing related Category records.
@relation("CategoryProposedBySeller")
25 sellerOrders SellerOrder[] REL No SellerOrder[] Virtual Prisma back-relation containing related SellerOrder records.
-
26 returnRequests ReturnRequest[] REL No ReturnRequest[] Virtual Prisma back-relation containing related ReturnRequest records.
-
27 sellerRatings SellerRating[] REL No SellerRating[] Virtual Prisma back-relation containing related SellerRating records.
-
28 productReviews ProductReview[] REL No ProductReview[] Virtual Prisma back-relation containing related ProductReview records.
-
29 productQuestions ProductQuestion[] REL No ProductQuestion[] Virtual Prisma back-relation containing related ProductQuestion records.
-
30 productAnswers ProductAnswer[] REL No ProductAnswer[] Virtual Prisma back-relation containing related ProductAnswer records.
-
31 payoutRequests PayoutRequest[] REL No PayoutRequest[] Virtual Prisma back-relation containing related PayoutRequest records.
-
32 walletTransactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
33 walletDebts SellerWalletDebt[] REL No SellerWalletDebt[] Virtual Prisma back-relation containing related SellerWalletDebt records.
-
34 inventoryTransactions InventoryTransaction[] REL No InventoryTransaction[] Virtual Prisma back-relation containing related InventoryTransaction records.
-
35 deals Deal[] REL No Deal[] Virtual Prisma back-relation containing related Deal records.
-
36 coupons Coupon[] REL No Coupon[] Virtual Prisma back-relation containing related Coupon records.
-
37 conversationThreads ConversationThread[] REL No ConversationThread[] Virtual Prisma back-relation containing related ConversationThread records.
-
38 aplusContents AplusContent[] REL No AplusContent[] Virtual Prisma back-relation containing related AplusContent records.
-
Relationship summary (21)
  • user -> User userId -> User.id
  • bankAccountDetails -> SellerBankAccountDetails Optional/one-to-one virtual relation
  • bankVerificationAttempts -> SellerBankVerificationAttempt Back relation / one-to-many collection
  • digitalWallet -> SellerDigitalWallet Optional/one-to-one virtual relation
  • products -> Product Back relation / one-to-many collection
  • productViews -> ProductView Back relation / one-to-many collection
  • proposedCategories -> Category Back relation / one-to-many collection
  • sellerOrders -> SellerOrder Back relation / one-to-many collection
  • returnRequests -> ReturnRequest Back relation / one-to-many collection
  • sellerRatings -> SellerRating Back relation / one-to-many collection
  • productReviews -> ProductReview Back relation / one-to-many collection
  • productQuestions -> ProductQuestion Back relation / one-to-many collection
  • productAnswers -> ProductAnswer Back relation / one-to-many collection
  • payoutRequests -> PayoutRequest Back relation / one-to-many collection
  • walletTransactions -> WalletTransaction Back relation / one-to-many collection
  • walletDebts -> SellerWalletDebt Back relation / one-to-many collection
  • inventoryTransactions -> InventoryTransaction Back relation / one-to-many collection
  • deals -> Deal Back relation / one-to-many collection
  • coupons -> Coupon Back relation / one-to-many collection
  • conversationThreads -> ConversationThread Back relation / one-to-many collection
  • aplusContents -> AplusContent Back relation / one-to-many collection

Table 43 / Seller, Wallet & Payouts

43) Table Name: SellerDigitalWallet

Stores seller wallet totals such as sales, withdrawn, available and reserve balance.

seller.prisma10 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String UQFK No uuid Foreign key reference to SellerProfile.id.
@unique
3 totalSales DecimalDecimal(12, 2) - No 0 Monetary/decimal value for total sales.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
4 withdrawn DecimalDecimal(12, 2) - No 0 Monetary/decimal value for withdrawn.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
5 available DecimalDecimal(12, 2) - No 0 Monetary/decimal value for available.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
6 reserve DecimalDecimal(12, 2) - No 0 Monetary/decimal value for reserve.
@default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2)
7 createdAt DateTime - No now() Record creation timestamp.
@default(now())
8 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
9 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
10 transactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
Relationship summary (2)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • transactions -> WalletTransaction Back relation / one-to-many collection

Table 44 / Seller, Wallet & Payouts

44) Table Name: SellerBankAccountDetails

Stores seller bank/UPI verification details and Cashfree provider references.

seller.prisma32 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String UQFK No uuid Foreign key reference to SellerProfile.id.
@unique
3 method BankVerificationMethod? - Yes UPI Enum value from BankVerificationMethod (UPI, BANK_DETAILS).
-
4 accountHolderName String? - Yes Sample Name Stores account holder name.
-
5 encryptedAccountNumber String? - Yes text AES-256-GCM
-
6 accountFingerprint String? UQ Yes text Security-sensitive stored value; use hashing/encryption as indicated by the field name.
@unique
7 ifscCode String? - Yes CODE123 Stores ifsc code.
-
8 bankName String? - Yes Sample Name Stores bank name.
-
9 upiId String? - Yes uuid Identifier reference for upi.
-
10 isVerified Boolean - No false Boolean flag for is verified.
@default(false)
11 cashfreeBeneficiaryId String? - Yes uuid Identifier reference for cashfree beneficiary.
-
12 cashfreeUpiRefId String? IDX Yes uuid Identifier reference for cashfree upi ref.
-
13 cashfreeVerificationId String? IDX Yes uuid Identifier reference for cashfree verification.
-
14 cashfreeBankReferenceId String? IDX Yes uuid Identifier reference for cashfree bank reference.
-
15 cashfreeBankUserId String? IDX Yes uuid Identifier reference for cashfree bank user.
-
16 cashfreeUpiValidUpto DateTime? - Yes now() Stores cashfree upi valid upto.
-
17 cashfreeUpiLink String? - Yes https://... Stores cashfree upi link.
-
18 cashfreeGpayLink String? - Yes https://... Stores cashfree gpay link.
-
19 cashfreeBhimLink String? - Yes https://... Stores cashfree bhim link.
-
20 cashfreePaytmLink String? - Yes https://... Stores cashfree paytm link.
-
21 cashfreePhonepeLink String? - Yes +91 9876543210 Stores cashfree phonepe link.
-
22 cashfreeQrCode String? - Yes CODE123 Stores cashfree qr code.
-
23 providerStatus String? - Yes text Stores provider status.
-
24 providerStatusCode String? - Yes CODE123 Stores provider status code.
-
25 providerResponse Json? - Yes {} Stores provider response.
-
26 failureReason String? - Yes text Stores failure reason.
-
27 verifiedAt DateTime? - Yes now() Date/time value for verified at.
-
28 createdAt DateTime - No now() Record creation timestamp.
@default(now())
29 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
30 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
31 payoutRequests PayoutRequest[] REL No PayoutRequest[] Virtual Prisma back-relation containing related PayoutRequest records.
-
32 verificationAttempts SellerBankVerificationAttempt[] REL No SellerBankVerificationAttempt[] Virtual Prisma back-relation containing related SellerBankVerificationAttempt records.
-
Relationship summary (3)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • payoutRequests -> PayoutRequest Back relation / one-to-many collection
  • verificationAttempts -> SellerBankVerificationAttempt Back relation / one-to-many collection
Indexes & constraints (4)
  • @@index([cashfreeUpiRefId])
  • @@index([cashfreeVerificationId])
  • @@index([cashfreeBankReferenceId])
  • @@index([cashfreeBankUserId])

Table 45 / Seller, Wallet & Payouts

45) Table Name: SellerBankVerificationAttempt

Stores each bank or UPI verification attempt with provider request/response payloads.

seller.prisma19 fields2 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 bankAccountId String? FK Yes uuid Foreign key reference to SellerBankAccountDetails.id.
-
4 method BankVerificationMethod IDX No UPI Enum value from BankVerificationMethod (UPI, BANK_DETAILS).
-
5 accountFingerprint String? UQ Yes text Security-sensitive stored value; use hashing/encryption as indicated by the field name.
@unique
6 cashfreeUpiRefId String? IDX Yes uuid Identifier reference for cashfree upi ref.
-
7 cashfreeVerificationId String? IDX Yes uuid Identifier reference for cashfree verification.
-
8 cashfreeBankReferenceId String? IDX Yes uuid Identifier reference for cashfree bank reference.
-
9 cashfreeBankUserId String? IDX Yes uuid Identifier reference for cashfree bank user.
-
10 providerStatus String? - Yes text Stores provider status.
-
11 providerStatusCode String? - Yes CODE123 Stores provider status code.
-
12 requestPayload Json? - Yes {} Stores request payload.
-
13 responsePayload Json? - Yes {} Stores response payload.
-
14 failureReason String? - Yes text Stores failure reason.
-
15 completedAt DateTime? - Yes now() Date/time value for completed at.
-
16 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
17 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
18 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
19 bankAccount SellerBankAccountDetails? REL Yes SellerBankAccountDetails Virtual Prisma relation to SellerBankAccountDetails.
@relation(fields: [bankAccountId], references: [id])
Relationship summary (2)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • bankAccount -> SellerBankAccountDetails bankAccountId -> SellerBankAccountDetails.id
Indexes & constraints (5)
  • @@index([sellerId, method, createdAt])
  • @@index([cashfreeUpiRefId])
  • @@index([cashfreeVerificationId])
  • @@index([cashfreeBankReferenceId])
  • @@index([cashfreeBankUserId])

Table 46 / Seller, Wallet & Payouts

46) Table Name: TradMark

Stores seller brand/trademark registration details, approval status and logo information.

seller.prisma21 fields3 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to User.id.
-
3 name String UQ No Sample Name Display name.
@unique
4 normalizedName String? UQ Yes Sample Name Stores normalized name.
@unique
5 tradeMarkStatus TradeMarkStatus IDX No PENDING Enum value from TradeMarkStatus (PENDING, PENDING_APPROVAL, ACTIVE, REJECTED).
@default(PENDING)
6 rejectMessage String? - Yes text Stores reject message.
-
7 slug String? UQ Yes sample-slug SEO-friendly unique URL identifier.
@unique
8 logoPublicId String? - Yes uuid Identifier reference for logo public.
-
9 logoUrl String? - Yes https://... Stores logo url.
-
10 description String? - Yes text Longer display/SEO description.
-
11 websiteUrl String? - Yes https://... Stores website url.
-
12 categoryId String? FKIDX Yes uuid Foreign key reference to Category.id.
-
13 isLocked Boolean - No false Boolean flag for is locked.
@default(false)
14 submittedAt DateTime? - Yes now() Date/time value for submitted at.
-
15 reviewDueAt DateTime? - Yes now() Date/time value for review due at.
-
16 approvedAt DateTime? - Yes now() Date/time value for approved at.
-
17 createdAt DateTime - No now() Record creation timestamp.
@default(now())
18 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
19 seller User REL No User Virtual Prisma relation to User.
@relation(fields: [sellerId], references: [id])
20 category Category? REL Yes Category Virtual Prisma relation to Category.
@relation(fields: [categoryId], references: [id])
21 products Product[] REL No Product[] Virtual Prisma back-relation containing related Product records.
-
Relationship summary (3)
  • seller -> User sellerId -> User.id
  • category -> Category categoryId -> Category.id
  • products -> Product Back relation / one-to-many collection
Indexes & constraints (2)
  • @@index([sellerId, tradeMarkStatus])
  • @@index([categoryId])

Table 47 / Seller, Wallet & Payouts

47) Table Name: WalletTransaction

Stores seller wallet ledger entries for credits, withdrawals, refunds, reserves and adjustments.

seller.prisma20 fields6 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 walletId String FKIDX No uuid Foreign key reference to SellerDigitalWallet.id.
-
3 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
4 type WalletTransactionType - No ORDER_CREDIT Enum value from WalletTransactionType (ORDER_CREDIT, WITHDRAWAL_INITIATED, WITHDRAWAL_COMPLETE, WITHDRAWAL_FAILED, REFUND_DEBIT, RESERVE_RELEASE...).
-
5 amount DecimalDecimal(14, 2) - No 0.00 Monetary amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
6 balanceAvailableAfter DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for balance available after.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
7 balanceReserveAfter DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for balance reserve after.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
8 balanceWithdrawnAfter DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for balance withdrawn after.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
9 sellerOrderId String? FKIDX Yes uuid Foreign key reference to SellerOrder.id.
-
10 orderItemId String? FK Yes uuid Foreign key reference to OrderItem.id.
-
11 payoutRequestId String? FKIDX Yes uuid Foreign key reference to PayoutRequest.id.
-
12 walletDebtId String? FKIDX Yes uuid Foreign key reference to SellerWalletDebt.id.
-
13 metadata Json? - Yes {} Flexible JSON metadata for extra provider or audit information.
-
14 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
15 wallet SellerDigitalWallet REL No SellerDigitalWallet Virtual Prisma relation to SellerDigitalWallet.
@relation(fields: [walletId], references: [id])
16 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
17 sellerOrder SellerOrder? REL Yes SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
18 orderItem OrderItem? REL Yes OrderItem Virtual Prisma relation to OrderItem.
@relation(fields: [orderItemId], references: [id])
19 payoutRequest PayoutRequest? REL Yes PayoutRequest Virtual Prisma relation to PayoutRequest.
@relation(fields: [payoutRequestId], references: [id])
20 walletDebt SellerWalletDebt? REL Yes SellerWalletDebt Virtual Prisma relation to SellerWalletDebt.
@relation(fields: [walletDebtId], references: [id])
Relationship summary (6)
  • wallet -> SellerDigitalWallet walletId -> SellerDigitalWallet.id
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • orderItem -> OrderItem orderItemId -> OrderItem.id
  • payoutRequest -> PayoutRequest payoutRequestId -> PayoutRequest.id
  • walletDebt -> SellerWalletDebt walletDebtId -> SellerWalletDebt.id
Indexes & constraints (5)
  • @@index([sellerId, createdAt])
  • @@index([walletId, createdAt])
  • @@index([sellerOrderId])
  • @@index([payoutRequestId])
  • @@index([walletDebtId])

Table 48 / Seller, Wallet & Payouts

48) Table Name: PayoutRequest

Stores seller withdrawal requests and provider payout status/UTR details.

seller.prisma27 fields4 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 bankAccountId String FKIDX No uuid Foreign key reference to SellerBankAccountDetails.id.
-
4 amount DecimalDecimal(14, 2) - No 0.00 Monetary amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
5 netAmount Decimal?Decimal(14, 2) - Yes 0.00 Monetary/decimal value for net amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
6 verificationFeeDeducted DecimalDecimal(14, 2) - No 0 Monetary/decimal value for verification fee deducted.
@default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2)
7 currency String - No "INR" Currency code for monetary values.
@default("INR")
8 mode PayoutMode - No IMPS Enum value from PayoutMode (IMPS, RTGS, NEFT, UPI).
@default(IMPS)
9 status PayoutRequestStatus IDX No PENDING Current workflow or lifecycle status.
@default(PENDING)
10 idempotencyKey String UQ No text Stores idempotency key.
@unique
11 cashfreeTransferId String? IDX Yes uuid Identifier reference for cashfree transfer.
-
12 cashfreeCfTransferId String? IDX Yes uuid Identifier reference for cashfree cf transfer.
-
13 cashfreeStatusCode String? - Yes CODE123 Stores cashfree status code.
-
14 cashfreeStatusDescription String? - Yes text Stores cashfree status description.
-
15 utr String? - Yes text Stores utr.
-
16 failureReason String? - Yes text Stores failure reason.
-
17 requestedAt DateTime IDX No now() Date/time value for requested at.
@default(now())
18 processingStartedAt DateTime? - Yes now() Date/time value for processing started at.
-
19 processedAt DateTime? - Yes now() Date/time value for processed at.
-
20 failedAt DateTime? - Yes now() Date/time value for failed at.
-
21 cancelledAt DateTime? - Yes now() Date/time value for cancelled at.
-
22 createdAt DateTime - No now() Record creation timestamp.
@default(now())
23 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
24 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
25 bankAccount SellerBankAccountDetails REL No SellerBankAccountDetails Virtual Prisma relation to SellerBankAccountDetails.
@relation(fields: [bankAccountId], references: [id])
26 deletionRequest DeletionRequest? REL Yes DeletionRequest Virtual Prisma relation to DeletionRequest.
-
27 walletTransactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
Relationship summary (4)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • bankAccount -> SellerBankAccountDetails bankAccountId -> SellerBankAccountDetails.id
  • deletionRequest -> DeletionRequest Optional/one-to-one virtual relation
  • walletTransactions -> WalletTransaction Back relation / one-to-many collection
Indexes & constraints (4)
  • @@index([sellerId, status, requestedAt])
  • @@index([bankAccountId])
  • @@index([cashfreeTransferId])
  • @@index([cashfreeCfTransferId])

Table 49 / Seller, Wallet & Payouts

49) Table Name: SellerWalletDebt

Stores seller negative wallet/debt recovery records created by returns or adjustments.

seller.prisma15 fields4 relations
No.FieldTypeKeyNullableDefault / ExampleDescription / Attributes
1 id String PK No uuid() Primary UUID identifier for the record.
@id @default(uuid())
2 sellerId String FKIDX No uuid Foreign key reference to SellerProfile.id.
-
3 sellerOrderId String? FKIDX Yes uuid Foreign key reference to SellerOrder.id.
-
4 returnRequestId String? FKIDX Yes uuid Foreign key reference to ReturnRequest.id.
-
5 initialAmount DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for initial amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
6 remainingAmount DecimalDecimal(14, 2) - No 0.00 Monetary/decimal value for remaining amount.
@db.Decimal(14, 2) | DB: Decimal(14, 2)
7 status WalletDebtStatus IDX No OPEN Current workflow or lifecycle status.
@default(OPEN)
8 reason String? - Yes text Stores reason.
-
9 createdAt DateTime IDX No now() Record creation timestamp.
@default(now())
10 updatedAt DateTime - No now() Record last update timestamp.
@updatedAt
11 recoveredAt DateTime? - Yes now() Date/time value for recovered at.
-
12 sellerProfile SellerProfile REL No SellerProfile Virtual Prisma relation to SellerProfile.
@relation(fields: [sellerId], references: [id])
13 sellerOrder SellerOrder? REL Yes SellerOrder Virtual Prisma relation to SellerOrder.
@relation(fields: [sellerOrderId], references: [id])
14 returnRequest ReturnRequest? REL Yes ReturnRequest Virtual Prisma relation to ReturnRequest.
@relation(fields: [returnRequestId], references: [id])
15 walletTransactions WalletTransaction[] REL No WalletTransaction[] Virtual Prisma back-relation containing related WalletTransaction records.
-
Relationship summary (4)
  • sellerProfile -> SellerProfile sellerId -> SellerProfile.id
  • sellerOrder -> SellerOrder sellerOrderId -> SellerOrder.id
  • returnRequest -> ReturnRequest returnRequestId -> ReturnRequest.id
  • walletTransactions -> WalletTransaction Back relation / one-to-many collection
Indexes & constraints (3)
  • @@index([sellerId, status, createdAt])
  • @@index([sellerOrderId])
  • @@index([returnRequestId])

Reference

Enum Dictionary

Enum values used by the Prisma schema for statuses, roles, payment states, order states, promotions and messaging.

No.Enum NameValuesAllowed Values
1AccountSetupPhase7PENDING, EMAIL_VERIFIED, PHONE_VERIFIED, KYC_VERIFIED, BANK_VERIFIED, TRADEMARK_SUBMITTED, COMPLETED
2AplusBlockType4IMAGE, HEADING, TEXT, VIDEO
3AplusContentLanguage3EN, HI, GU
4AplusContentStatus3DRAFT, PUBLISHED, ARCHIVED
5AuditEvent7BUYER_SIGNUP, BUYER_LOGIN, SELLER_SIGNUP, SELLER_LOGIN, PASSWORD_RESET, ACCOUNT_DELETION, SESSION_REVOKED
6BankVerificationMethod2UPI, BANK_DETAILS
7BankVerificationStatus11PENDING, KYC_VERIFIED, CONTACT_CREATED, FUND_ACCOUNT_CREATED, VALIDATION_INITIATED, REVERSE_PENNY_DROP_PENDING, VERIFIED, FUND_ACCOUNT_FAILED, VALIDATION_FAILED, NAME_MISMATCHED, TECHNICAL_ERROR
8CategoryStatus4PENDING_APPROVAL, ACTIVE, REJECTED, ARCHIVED
9CouponApplicability3ALL_SELLER_PRODUCTS, SPECIFIC_PRODUCTS, CATEGORY
10CouponRedemptionStatus4RESERVED, APPLIED, RELEASED, CANCELLED
11DealType2LIGHTNING, BEST_DEAL
12DiscountType2PERCENTAGE, FIXED_AMOUNT
13InventoryTransactionType7STOCK_ADJUSTMENT, ORDER_RESERVED, ORDER_RELEASED, ORDER_FULFILLED, RETURN_RESTOCK, PAUSE_LISTING, RESUME_LISTING
14MessageType2TEXT, IMAGE
15NotificationType14ORDER_CREATED, ORDER_STATUS_CHANGED, WALLET_CREDITED, PAYOUT_SUCCEEDED, PAYOUT_FAILED, BRAND_APPROVED, BRAND_REJECTED, PRODUCT_QUESTION_CREATED, PRODUCT_QUESTION_ANSWERED, MESSAGE_RECEIVED, RATING_RECEIVED, STOCK_BACK, ACCOUNT_DELETION, BANK_VERIFICATION_REVIEW
16OrderStatus17PENDING_SELLER_APPROVAL, PROCESSING, SHIPPED, OUT_FOR_DELIVERY, DELIVERED, RETURN_INITIATED, RETURN_APPROVED, RETURN_REQUESTED, RETURN_ACCEPTED, RETURN_SHIPPED, INVESTIGATION, REFUND_PROCESSING, REFUNDED, REFUND_REJECTED, RETURN_REJECTED, CLOSED, CANCELLED
17OtpChannel2email, phone
18OtpPurpose4VERIFICATION_OTP, LOGIN_OTP, PASSWORD_RESET_OTP, ACCOUNT_DELETION_OTP
19PaymentStatus6PENDING, CAPTURED, FAILED, REFUND_INITIATED, REFUNDED, PARTIALLY_REFUNDED
20PayoutMode4IMPS, RTGS, NEFT, UPI
21PayoutRequestStatus6PENDING, PROCESSING, COMPLETED, FAILED, CANCELLED, REVERSED
22ProductCondition3NEW, REPLACE, REUSE
23ProductStatus5DRAFT, ACTIVE, PAUSED, OUT_OF_STOCK, DELETED
24PromotionStatus5DRAFT, SCHEDULED, ACTIVE, ENDED, CANCELLED
25QuestionStatus4UNANSWERED, ANSWERED, REPORTED, HIDDEN
26ReturnRequestStatus15REQUESTED, UNDER_REVIEW, APPROVED, REJECTED, PICKUP_SCHEDULED, RECEIVED, REFUNDED, CLOSED, RETURN_REQUESTED, RETURN_ACCEPTED, RETURN_REJECTED, RETURN_SHIPPED, INVESTIGATION, REFUND_PROCESSING, REFUND_REJECTED
27ReviewStatus4PUBLISHED, HIDDEN, REPORTED, DELETED
28Role3BUYER, SELLER, ADMIN
29TargetGender3MALE, FEMALE, UNISEX
30TradeMarkStatus4PENDING, PENDING_APPROVAL, ACTIVE, REJECTED
31UserProfileStatus4PENDING, ACTIVE, SUSPENDED, DELETED
32WalletDebtStatus4OPEN, PARTIALLY_RECOVERED, RECOVERED, WRITTEN_OFF
33WalletTransactionType9ORDER_CREDIT, WITHDRAWAL_INITIATED, WITHDRAWAL_COMPLETE, WITHDRAWAL_FAILED, REFUND_DEBIT, RESERVE_RELEASE, ADJUSTMENT_CREDIT, ADJUSTMENT_DEBIT, FINAL_SETTLEMENT