Initial commit: Slim Framework 4 API Retribusi dengan modular architecture
This commit is contained in:
57
migrations/README.md
Normal file
57
migrations/README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Database Migrations
|
||||
|
||||
## Cara Apply Migration
|
||||
|
||||
### 1. Backup Database (PENTING!)
|
||||
Sebelum menjalankan migration, pastikan untuk backup database terlebih dahulu:
|
||||
|
||||
```bash
|
||||
mysqldump -u sql_retribusi -p sql_retribusi > backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
```
|
||||
|
||||
### 2. Apply Migration
|
||||
|
||||
#### Menggunakan MySQL Command Line:
|
||||
```bash
|
||||
mysql -u sql_retribusi -p sql_retribusi < migrations/001_create_audit_logs.sql
|
||||
```
|
||||
|
||||
#### Menggunakan phpMyAdmin:
|
||||
1. Login ke phpMyAdmin
|
||||
2. Pilih database `sql_retribusi`
|
||||
3. Klik tab "SQL"
|
||||
4. Copy-paste isi file `001_create_audit_logs.sql`
|
||||
5. Klik "Go" untuk execute
|
||||
|
||||
#### Menggunakan MySQL Workbench:
|
||||
1. Buka MySQL Workbench
|
||||
2. Connect ke database server
|
||||
3. Pilih database `sql_retribusi`
|
||||
4. File → Run SQL Script
|
||||
5. Pilih file `001_create_audit_logs.sql`
|
||||
6. Klik "Run"
|
||||
|
||||
### 3. Verifikasi
|
||||
|
||||
Setelah migration berhasil, verifikasi tabel sudah dibuat:
|
||||
|
||||
```sql
|
||||
SHOW TABLES LIKE 'audit_logs';
|
||||
DESCRIBE audit_logs;
|
||||
```
|
||||
|
||||
## Daftar Migration
|
||||
|
||||
### 001_create_audit_logs.sql
|
||||
- **Tanggal**: 2024-12-28
|
||||
- **Deskripsi**: Membuat tabel `audit_logs` untuk tracking semua perubahan data (create/update/delete)
|
||||
- **Tabel**: `audit_logs`
|
||||
- **Rollback**: Tidak ada (tabel ini critical untuk audit, tidak boleh dihapus)
|
||||
|
||||
## Catatan Penting
|
||||
|
||||
- **JANGAN** hapus atau modify migration file yang sudah di-apply
|
||||
- Selalu backup database sebelum apply migration
|
||||
- Test migration di environment development terlebih dahulu
|
||||
- Jika terjadi error, restore dari backup dan perbaiki migration file
|
||||
|
||||
Reference in New Issue
Block a user