chore(db): clean legacy sql assets and standardize migrations
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# Server Migration Checklist (BladeX + Martial)
|
||||
|
||||
## 1. Database initialization policy
|
||||
|
||||
- MySQL init mount must point to `./database/init` only.
|
||||
- Keep `database/init` minimal. Avoid full backups or system DB dumps.
|
||||
- Schema evolution should be managed by Flyway migrations.
|
||||
|
||||
## 2. Flyway pre-check
|
||||
|
||||
Before first migration on an existing environment, run validate with pending ignored:
|
||||
|
||||
```bash
|
||||
mvn -Dflyway.url=jdbc:mysql://<host>:3306/martial_db \
|
||||
-Dflyway.user=<user> \
|
||||
-Dflyway.password=<password> \
|
||||
-Dflyway.locations=filesystem:src/main/resources/db/migration \
|
||||
-Dflyway.ignoreMigrationPatterns='*:pending' \
|
||||
flyway:validate
|
||||
```
|
||||
|
||||
Expected result: `BUILD SUCCESS`.
|
||||
|
||||
## 3. First boot sequence
|
||||
|
||||
1. Start MySQL/Redis/MinIO.
|
||||
2. Start martial-api.
|
||||
3. Flyway applies migrations (V0..latest).
|
||||
4. Confirm schema version and service health.
|
||||
|
||||
## 4. Post-migration verification SQL
|
||||
|
||||
```sql
|
||||
-- flyway history
|
||||
SELECT version, description, success
|
||||
FROM flyway_schema_history
|
||||
ORDER BY installed_rank;
|
||||
|
||||
-- core BladeX tables
|
||||
SELECT table_name
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema='martial_db' AND table_name LIKE 'blade\\_%'
|
||||
ORDER BY table_name;
|
||||
|
||||
-- compatibility table used by mini module
|
||||
SELECT table_name
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema='martial_db' AND table_name='mt_venue';
|
||||
```
|
||||
|
||||
## 5. Rollback note
|
||||
|
||||
- Do not rollback by replaying full backup SQL into a running environment.
|
||||
- Prefer restoring from DB snapshot/backup at infrastructure level.
|
||||
Reference in New Issue
Block a user