# Current Local Database (SQLite)

This describes what exists **right now** in the rebuild app (`app/database/database.sqlite`).

## Local DB engine

- SQLite (file: `app/database/database.sqlite`)

## Tables present

Framework defaults:
- `cache`
- `cache_locks`
- `failed_jobs`
- `job_batches`
- `jobs`
- `migrations`
- `password_reset_tokens`
- `sessions`
- `users`

Dewemoji core tables:
- `licenses`
- `license_activations`
- `usage_logs`

## Current row counts (local)

- `emojis`: 2131
- `emoji_keywords`: 13420
- `emoji_aliases`: 0
- `emoji_shortcodes`: 0
- `licenses`: 7
- `license_activations`: 1
- `usage_logs`: 88
- `ai_guard_logs`: 54
- `ai_judgments`: 0
- `ai_lang_cache`: 6
- `ai_provider_usage`: 4
- `legacy_users`: 0
- `legacy_sessions`: 0

## What is *not* in local DB yet (from live SQL)

From `dewemoji-live-backend/dewemojiAPI_DB.sql`, these tables exist in live but are **still empty locally**:

- `emoji_aliases`
- `emoji_shortcodes`
- `ai_judgments`
- `legacy_users` (live users)
- `legacy_sessions` (live sessions)

## Why emojis still work locally

The rebuild app currently reads emojis from a **JSON dataset** (not DB):
- `app/data/emojis.json`

That’s why the UI works even though emoji tables aren’t present yet.

## Next step (if you want to migrate live SQL)

Migrations + importer are now in place. To sync everything locally (SQLite), run:

```bash
cd /Users/dwindown/Developments/dewemoji/app
php artisan migrate
php artisan dewemoji:import-live-sql /Users/dwindown/Developments/dewemoji-live-backend/dewemojiAPI_DB.sql --truncate
```

Notes:
- Live `users` + `sessions` go into `legacy_users` + `legacy_sessions` (so Laravel auth/session tables stay safe).
- Licenses/activations/usage_logs are mapped into the current tables for parity.

Just tell me which subset to migrate first.
