Overview
Thebilleteras table stores wallet accounts for users. Each user can create multiple wallets to organize their finances across different accounts (e.g., cash, bank account, savings).
Table Schema
Columns
Primary key. Auto-generated unique identifier for the wallet.
Wallet name. User-defined label for the wallet (max 13 characters).
Foreign key to
auth.users. Links the wallet to its owner.Timestamp when the wallet was created. Auto-set by database.
Timestamp when the wallet was last modified. Auto-updated.
Relationships
- One-to-Many with
transacciones: A wallet can have many transactions - Many-to-One with
auth.users: Each wallet belongs to one user
Row Level Security (RLS)
The table enforces RLS policies to ensure users can only access their own wallets:Example Queries
Fetch All Wallets for Current User
Create a New Wallet
Update Wallet Name
Delete a Wallet
Validation Rules
- Name Length: Maximum 13 characters (enforced in UI)
- Name Required: Cannot be empty or null
- User Ownership: Must belong to authenticated user
- Deletion Constraint: Cannot delete wallets with transactions
Indexes
Related Tables
Transactions
View transactions associated with wallets
Categories
Categories used in wallet transactions
