# Database Bootstrap

This document describes the database files included in the repository and the current bootstrap model used for the Debian VPS.

## Databases

The current server layout expects these databases:

- `account`
- `player`
- `common`
- `log`
- `hotbackup`

## Repository SQL Files

Relevant files:

- `sql/database_create/database_create.sql`
- `sql/account.sql`
- `sql/player.sql`
- `sql/common.sql`
- `sql/log.sql`
- `sql/hotbackup_(empty).sql`
- `sql/my.cnf`
- `sql/my.cnf.bak_for_mysql5.6`

## Practical Import Order

Typical bootstrap order:

1. create databases and database user
2. import `account.sql`
3. import `player.sql`
4. import `common.sql`
5. import `log.sql`
6. import `hotbackup_(empty).sql`

## Notes About The Included SQL Config Files

`sql/my.cnf` and related files are legacy reference material. They are not the authoritative production configuration for the Debian VPS.

The Debian runtime currently uses MariaDB and system-level service management rather than a repo-owned database daemon.

## Current Runtime Expectation

Server config files reference:

- `DB_ADDR: 127.0.0.1`
- `DB_PORT: 9000`

This means:

- the game/auth processes connect to the DB proxy/cache process on `127.0.0.1:9000`
- that DB process then talks to MariaDB using the configured SQL credentials

## Production Reality

The current production VPS already has the databases imported and in use. The headless login healthcheck proves that `account` and `player` reads/writes are working end-to-end.

## Recommended Follow-Up

This repo should eventually gain a Debian-first documented bootstrap script or runbook that covers:

- MariaDB package installation
- SQL mode compatibility
- database/user creation
- import commands
- post-import verification
