# Start with a fresh café database

The CLI script `tools/reset-database.php` removes all café records, accounts and settings from the database named in `.env`. It rebuilds the schema, restores required default roles and options, and creates a new manager account. It does not delete uploaded images or documents.

1. Take the site offline and make a database backup. For example, use `mysqldump -u YOUR_DB_USER -p --single-transaction cafe_shop > /root/cafe_shop_before_reset.sql`. Keep that file private and outside the web root.
2. On the server, in the project directory, run `php tools/reset-database.php cafe_shop`. Replace `cafe_shop` with the exact database name configured in `.env`.
3. Enter the new café and manager details. The password is hidden while you type it on an Ubuntu terminal. The script checks your answers before asking you to type `RESET cafe_shop` to confirm deletion.
4. Set `CI_ENVIRONMENT = production` in the private `.env`, verify that you can sign in with the new manager, then bring the site back online.

If hidden password input is unavailable, set `CAFE_RESET_MANAGER_PASSWORD` only for this command. Do not put the password in the command arguments or save it in this repository.

The script refuses to run from a browser, against a different database name, or against an existing schema without migration history. It invalidates old file-based login sessions after the reset. Keep the site offline if a migration or session-clear error occurs, and restore the backup before retrying.
