Skip to content

Commit 891fb85

Browse files
Copilotvncloudsco
andcommitted
Add PostgreSQL to SQLite migration script and documentation
Co-authored-by: vncloudsco <[email protected]>
1 parent 10b1c2c commit 891fb85

File tree

2 files changed

+624
-0
lines changed

2 files changed

+624
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Nginx WAF - Advanced Nginx Management Platform offers full support for major ope
4040
| **New Server (Production)** | `./scripts/deploy.sh` | Full installation of Nginx + ModSecurity + Backend + Frontend with systemd services |
4141
| **Development/Testing** | `./scripts/quickstart.sh` | Quick run in dev mode (no Nginx installation, no root required) |
4242
| **Upgrade New Version** | `./scripts/update.sh` | Full update to new version |
43+
| **Migrate PostgreSQL → SQLite** | `./scripts/migrate-postgres-to-sqlite.sh` | Migrate existing PostgreSQL data to SQLite (see [Migration Guide](docs/MIGRATION_POSTGRES_TO_SQLITE.md)) |
4344

4445
| Use Case | Port | Description |
4546
|----------|--------|-------------|
@@ -69,6 +70,32 @@ git pull
6970
bash scripts/update.sh
7071
```
7172

73+
### 🔄 Migrating from PostgreSQL to SQLite
74+
75+
If you have an existing installation using PostgreSQL and want to migrate to SQLite:
76+
77+
```bash
78+
# Navigate to your nginx-love directory
79+
cd nginx-love
80+
81+
# Run the migration script (requires root)
82+
sudo bash scripts/migrate-postgres-to-sqlite.sh
83+
```
84+
85+
**What the migration script does:**
86+
- ✅ Exports all data from PostgreSQL (users, domains, SSL certificates, rules, etc.)
87+
- ✅ Creates a new SQLite database
88+
- ✅ Imports all data with proper type conversions
89+
- ✅ Backs up your original configuration
90+
- ✅ Provides rollback instructions if needed
91+
92+
**After migration:**
93+
1. Restart services: `sudo systemctl restart nginx-love-backend nginx-love-frontend`
94+
2. Verify all data is present in the web interface
95+
3. Optionally remove PostgreSQL: See [Migration Guide](docs/MIGRATION_POSTGRES_TO_SQLITE.md)
96+
97+
📖 **Full Migration Guide**: [docs/MIGRATION_POSTGRES_TO_SQLITE.md](docs/MIGRATION_POSTGRES_TO_SQLITE.md)
98+
7299
### 🖥️ Production Deployment (Docker container)
73100

74101
## Environment Setup

0 commit comments

Comments
 (0)