28 خطوط
1021 B
Markdown
28 خطوط
1021 B
Markdown
# MySQL migration
|
|
|
|
MicroLearn uses MySQL 8.4 in development, tests, CI, production, and on-premise deployments.
|
|
|
|
## One-time local migration from SQLite
|
|
|
|
1. Back up `backend/database/database.sqlite` and stop API/queue processes that can write to it.
|
|
2. Create an empty MySQL database and a least-privilege application user using `utf8mb4`.
|
|
3. Set the MySQL `DB_*` values in `backend/.env`.
|
|
4. Clear cached configuration and import the legacy data:
|
|
|
|
```sh
|
|
cd backend
|
|
php artisan config:clear
|
|
php artisan db:import-sqlite database/database.sqlite
|
|
```
|
|
|
|
The importer applies all migrations to MySQL, requires the destination application tables to be empty, copies matching columns in batches, and leaves the SQLite source unchanged. Keep the SQLite backup until record counts and application smoke tests have been verified.
|
|
|
|
## Verification
|
|
|
|
```sh
|
|
php artisan migrate:status
|
|
php artisan test
|
|
```
|
|
|
|
Production backup and restore use `mysqldump` and `mysql` through `scripts/backup.sh` and `scripts/restore.sh`.
|