mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
feat(db): add embedded auto-migrating schema system
Replace 4 independent schema management code paths (Docker shell script, setup wizard pg_restore, test helpers, manual psql) with a single migration runner embedded in the server binary. The new server/migrations/ package uses Go embed to bundle all SQL schemas. On startup, Migrate() creates a schema_version tracking table, detects existing databases (auto-marks baseline as applied), and runs pending migrations in transactions. Key changes: - Consolidated init.sql + 9.2-update + 33 patches into 0001_init.sql - Setup wizard simplified to single "Apply schema" checkbox - Test helpers use migrations.Migrate() instead of pg_restore - Docker no longer needs schema volume mounts or init script - Seed data (shops, events, gacha) embedded and applied via API - Future migrations just add 0002_*.sql files — no manual steps
This commit is contained in:
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@@ -81,7 +81,6 @@ jobs:
|
||||
./www/
|
||||
./savedata/
|
||||
./bin/
|
||||
./bundled-schema/
|
||||
retention-days: 7
|
||||
|
||||
- name: Build Windows-amd64
|
||||
@@ -97,7 +96,6 @@ jobs:
|
||||
./www/
|
||||
./savedata/
|
||||
./bin/
|
||||
./bundled-schema/
|
||||
retention-days: 7
|
||||
|
||||
lint:
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -45,9 +45,7 @@ jobs:
|
||||
cp config.example.json staging/
|
||||
cp -r www/ staging/www/
|
||||
cp -r savedata/ staging/savedata/
|
||||
cp -r schemas/ staging/schemas/
|
||||
# Create a standalone SCHEMA.sql from init schema for convenience
|
||||
cp schemas/init.sql staging/SCHEMA.sql
|
||||
# Schema is now embedded in the binary via server/migrations/
|
||||
cd staging && zip -r ../erupe-${{ matrix.os_name }}.zip .
|
||||
|
||||
- name: Upload build artifact
|
||||
@@ -70,8 +68,8 @@ jobs:
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Copy SCHEMA.sql for standalone download
|
||||
run: cp schemas/init.sql SCHEMA.sql
|
||||
- name: Copy standalone schema for download
|
||||
run: cp server/migrations/sql/0001_init.sql SCHEMA.sql
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
||||
Reference in New Issue
Block a user