Every great application starts with a solid data foundation. In this post, we take a look at how we designed the database schema that powers Your Poker's tournament management engine.
SQLite: The Right Choice for Desktop
We chose SQLite as our database engine — and it's been one of the best decisions we've made. For a desktop application that needs to work offline, SQLite is perfect:
- Zero configuration — No database server to install or manage
- Single file storage — Your entire tournament history lives in one portable file
- ACID compliant — Full transaction support ensures data integrity
- Incredible performance — Handles thousands of records without breaking a sweat
The Schema
Our schema consists of 12 interconnected tables that model the complete poker tournament ecosystem:
- Players — The core player registry with contact details and notes
- Tournaments — Tournament configuration including buy-in, starting chips, and status tracking
- Schedule Levels — Blind levels with small blind, big blind, ante, and duration
- Tables — Physical table assignments with capacity management
- Tournament Players — The junction between players and tournaments, tracking buy-ins, rebuys, add-ons, and finishing positions
- Payouts — Prize distribution with position-based amounts
- Templates — Reusable configurations for schedules, payouts, and points systems
Enforcing Data Integrity
We enforce foreign key constraints at the database level, ensuring that relationships between tables are always consistent. Every tournament player must reference a valid player and tournament. Every schedule level must belong to a real tournament. This prevents orphaned records and data corruption.
Combined with Rust's type system on the backend, we have multiple layers of protection ensuring your tournament data is always accurate and reliable.