sql/, and both initialization and upgrades run through incremental scripts.
Script layout
- Filename format:
<timestamp>_v<version>.x.sql; the script runs them sorted by filename. - The earliest baseline script under
sql/increment/1.0/contains the full schema. sql/local/is a flat execution record and is git-ignored.
Initialization and upgrades
After creating the database, configurebin/local/deploy.conf and run:
Execution rules
- Scripts already recorded in
sql/local/are skipped, so reruns are safe. - Different versions or changes must not share a filename (the record directory is flat).
- New incremental SQL uses the current time; backfilled changes use their historical time to keep timestamps ordered.
Main objects
- Posts, categories, tags, columns and their relations
- Moments, comments and likes
- Site settings, friends and about page
- Users, roles and logs
Notes
- When structure or seed data changes, add a new incremental script instead of editing an executed one.
- After changing seed data, sync the database and clear caches as needed.