Skip to main content

WhiskyPay Database Schema

WhiskyPay uses Supabase (PostgreSQL) for data storage. This page documents the database schema, explaining each table’s purpose and structure.

Tables Overview

The database consists of five primary tables:
  1. users - Merchant information
  2. tiers - Pricing tiers for each merchant
  3. buyers - Customer purchase records
  4. sessions - Payment session data
  5. signatures - Transaction signature verification

Table Structures

users

Stores information about merchants who use the WhiskyPay system.

tiers

Stores pricing information for each merchant’s subscription tiers or products.

buyers

Records of customers who have made purchases.

sessions

Stores payment session information.

signatures

Tracks transaction signatures to prevent double-spending and verify payments.

Relationships

  • A user (merchant) can have multiple tiers
  • A user can have multiple buyers
  • A user can create multiple sessions
  • Each session is associated with one user

Migration Scripts

When migrating from other databases (such as MongoDB), you can use the following sample migration script:

Database Setup

To create these tables in Supabase, you can use the SQL editor in the Supabase dashboard or run the schema through other PostgreSQL tools. For a complete setup script, refer to the SQL files in the GitHub repository or check the migration-saas-table.sql and new-structure.sql files in the project root.