Database
Zander uses MySQL with Prisma as the ORM. This page documents the connection setup, how to apply migrations, and a full breakdown of every model in the schema so you know exactly where your data lives. The schema is defined in prisma/schema.prisma.
Connections
Three separate MySQL connections can be configured:
| Variable | Purpose |
|---|---|
DATABASE_URL | Main Zander database (required) |
LUCKPERMS_URL | LuckPerms database — used for rank/permission lookups (required if using ranks) |
QUICKSHOP_URL | QuickShop database — used for the shop directory (required if using shop directory) |
Connection strings use the format:
mysql://username:password@host:3306/database_name
Initial Setup
Run the SQL initialisation script to create the base schema, then apply all numbered migrations from the migration/ directory in order:
mysql -u root -p zander < dbinit.sql
# then for each migration file in order:
mysql -u root -p zander < migration/001_name.sql
For new deployments using the Prisma build script:
npm run build
This runs prisma migrate deploy and prisma generate automatically.
Schema Overview
The following models are defined in prisma/schema.prisma:
Users & Authentication
| Model | Description |
|---|---|
users | Core user accounts — UUID, username, email, password hash, profile data, social links |
userEmailVerifications | Email verification tokens |
userPasswordResets | Password reset tokens |
userVerifyLink | Short-lived codes for linking Discord accounts to Minecraft UUIDs |
Sessions
| Model | Description |
|---|---|
session | Express session store (Prisma-backed) |
Forums
| Model | Description |
|---|---|
forumCategories | Forum categories with view/post permission nodes |
forumDiscussions | Discussion threads |
forumPosts | Individual posts/replies |
forumPostRevisions | Edit history for posts |
forumPolls | Polls embedded in discussions |
forumPollOptions | Poll answer options |
forumPollVotes | User vote records |
Announcements & Servers
| Model | Description |
|---|---|
announcements | Multi-type announcements (web, popup, tip, motd) |
servers | Server registry with connection details and type |
Discord
| Model | Description |
|---|---|
discord_punishments | Punishment records (warn, kick, ban, mute) with expiry and status |
discord_punishment_appeals | Appeal submissions and review outcomes |
scheduledDiscordMessages | Scheduled message queue for the Discord scheduler |
Support
| Model | Description |
|---|---|
supportTickets | Support ticket records with category and status |
supportTicketMessages | Messages and internal notes within tickets |
Reports & Punishments (Web)
| Model | Description |
|---|---|
reports | Player reports submitted via web or Discord |
punishments | Web-side punishments (warning, temp ban, permanent ban) |
Voting
| Model | Description |
|---|---|
votes | Individual vote records |
vote_sites | Configured voting sites |
vote_reward_templates | Command templates for vote and monthly rewards |
vote_monthly_totals | Aggregated monthly vote counts per player |
vote_monthly_results | Processed monthly reward results |
player_command_queue | Queue of reward commands to execute in-game |
Events
| Model | Description |
|---|---|
events | Community events with full lifecycle state |
event_templates | Recurring event templates |
event_hosts | Host assignments for events |
event_actions | In-game actions triggered by events |
event_announcements | Discord/web announcements tied to events |
event_audit_logs | Change history for events |
Creator Content
| Model | Description |
|---|---|
creator_content_items | Cached Twitch/YouTube content items |
user_platform_connections | Twitch/YouTube account links for users |
Bridge & Automation
| Model | Description |
|---|---|
executorTasks | Individual command tasks in the bridge executor queue |
executorRoutines | Named multi-step routines for the bridge |
Notifications
| Model | Description |
|---|---|
userNotifications | In-app notification records |
pushSubscriptions | Web push subscription endpoints per user |
Migrations
Migration files are located in migration/. Run them in numeric order. After applying all migrations, the Prisma client must be regenerated:
npx prisma generate