# Version 1.6 - SQLite Database Upgrade

Version 1.6 replaces the older `data.json` lead store with a SQLite database file.

## New database file

By default, the app stores data in:

```text
pestlead.sqlite
```

You can override this in `.env`:

```env
SQLITE_DB_PATH=./pestlead.sqlite
```

## SQLite engine

This build uses `sql.js`, which is SQLite compiled to WebAssembly. It avoids native Node build problems that can happen with `sqlite3` or `better-sqlite3` on shared cPanel hosting.

For this demo/early-client system, that is intentional: it gives you a real SQLite database file without requiring HostKoala/cPanel to compile native Node modules.

## Migration from data.json

If `pestlead.sqlite` is empty and `data.json` exists, the app will attempt to migrate the old JSON data automatically on startup.

You can also run migration manually:

```bash
npm run migrate-json
```

## Backup

Back up this file:

```text
pestlead.sqlite
```

## Files changed

- `src/db.js`
- `src/initDb.js`
- `src/migrateJsonToSqlite.js`
- `package.json`
- `.env.example`
- `.gitignore`
- `README.md`
