SQLite to PostgreSQL Migration
Migrate your Gauzy database from SQLite to PostgreSQL for production.
Why Migrate?โ
| Feature | SQLite | PostgreSQL |
|---|---|---|
| Concurrency | Single write | Multi-user |
| Performance | Small datasets | Large datasets |
| Scalability | Limited | Highly scalable |
| Features | Basic | Full SQL support |
| Backup | File copy | pg_dump, PITR |
| Recommended for | Development | Production |
Migration Stepsโ
1. Set Up PostgreSQLโ
# Install PostgreSQL
sudo apt install postgresql
# Create database and user
sudo -u postgres createuser gauzy
sudo -u postgres createdb gauzy -O gauzy
sudo -u postgres psql -c "ALTER USER gauzy PASSWORD 'your-password';"
2. Export SQLite Dataโ
# Use the Gauzy export tool
curl -H "Authorization: Bearer $TOKEN" \
http://localhost:3000/api/export/all \
-o gauzy-data-export.json
3. Update Configurationโ
Change .env:
- DB_TYPE=sqlite
- DB_NAME=gauzy.sqlite3
+ DB_TYPE=postgres
+ DB_HOST=localhost
+ DB_PORT=5432
+ DB_NAME=gauzy
+ DB_USER=gauzy
+ DB_PASS=your-password
4. Start API (Creates Schema)โ
yarn start:api
TypeORM will create all tables automatically on first start.
5. Import Dataโ
curl -X POST -H "Authorization: Bearer $TOKEN" \
-F "file=@gauzy-data-export.json" \
http://localhost:3000/api/import/all
6. Verifyโ
- Check all tables have data
- Test login and basic operations
- Verify time logs and invoices
Related Pagesโ
- Database Connection Issues โ troubleshooting
- Environment Variables โ DB config