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:users- Merchant informationtiers- Pricing tiers for each merchantbuyers- Customer purchase recordssessions- Payment session datasignatures- Transaction signature verification
Table Structures
users
Stores information about merchants who use the WhiskyPay system.| Column | Type | Description |
|---|---|---|
id | UUID | Primary key, unique identifier for the merchant |
created_at | TIMESTAMP | When the merchant was created |
updated_at | TIMESTAMP | When the merchant was last updated |
public_key | TEXT | Merchant’s Solana wallet public key |
saas_name | TEXT | Name of the merchant’s SaaS/business |
logo_url | TEXT | URL to the merchant’s logo |
address | TEXT | Merchant’s Solana wallet address for receiving payments |
call_back | TEXT | Webhook URL to notify after successful payments |
email | TEXT | Merchant’s email address |
tiers
Stores pricing information for each merchant’s subscription tiers or products.| Column | Type | Description |
|---|---|---|
id | UUID | Primary key |
created_at | TIMESTAMP | When the tier was created |
updated_at | TIMESTAMP | When the tier was last updated |
saas_id | UUID | Foreign key to the users table |
tier_name | TEXT | Name of the tier/plan (e.g., “Basic”, “Premium”) |
price | NUMERIC | Price of the tier in USD |
buyers
Records of customers who have made purchases.| Column | Type | Description |
|---|---|---|
id | UUID | Primary key |
created_at | TIMESTAMP | When the record was created |
updated_at | TIMESTAMP | When the record was last updated |
saas_id | UUID | Foreign key to the users table |
email | TEXT | Customer’s email address |
plan | TEXT | Plan/tier purchased |
price | NUMERIC | Amount paid in USD |
time | TIMESTAMP | When the purchase occurred |
sessions
Stores payment session information.| Column | Type | Description |
|---|---|---|
id | UUID | Primary key, session identifier |
created_at | TIMESTAMP | When the session was created |
saas_id | UUID | Foreign key to the users table |
saas_name | TEXT | Name of the merchant |
time | TIMESTAMP | Session creation time |
email | TEXT | Customer’s email address |
address | TEXT | Merchant’s payment receiving address |
logo_url | TEXT | URL to the merchant’s logo |
plan | TEXT | Plan/tier being purchased |
price | NUMERIC | Price in USD |
signatures
Tracks transaction signatures to prevent double-spending and verify payments.| Column | Type | Description |
|---|---|---|
id | UUID | Primary key |
created_at | TIMESTAMP | When the signature was recorded |
signature | TEXT | Solana transaction signature |
Relationships
- A
user(merchant) can have multipletiers - A
usercan have multiplebuyers - A
usercan create multiplesessions - Each
sessionis associated with oneuser
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 themigration-saas-table.sql and new-structure.sql files in the project root.