UniSierra Eats stores all application data in a single SQLite file namedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
unisierra_eats.db, created automatically in the project root the first time init_db.js runs. The script creates all four tables using CREATE TABLE IF NOT EXISTS and populates them with seed roles, an administrator account, and eight sample cafeteria products. Because every write uses either IF NOT EXISTS or INSERT OR IGNORE, you can safely re-run the script against an existing database without overwriting live data.
How the Server Connects
At startup,server.js opens the same database file with the sqlite3 package. The connection block is:
./unisierra_eats.db is relative to the working directory from which node server.js is launched, so the server must always be started from the project root.
Initialization Steps
Ensure you are in the project root directory
All paths in both
init_db.js and server.js are relative to the project root. Before running any command, confirm your terminal is in the right place:Run the initialization script
Execute
init_db.js with Node.js to create the database file, build the schema, and insert seed data:Verify the output
A successful run prints confirmation messages to the console:You should also see a new file
unisierra_eats.db appear in the project root.Resetting the Database
To wipe all data and start fresh, delete the database file and re-run the initialization script:Full init_db.js Script
Seed Data Reference
Roles
Two roles are inserted with explicit IDs so the application can reference them by a known constant:| id | nombre |
|---|---|
| 1 | Administrador |
| 2 | Estudiante |
Administrator Account
A single admin user is seeded for first-time access. This account is assignedrol_id = 1 (Administrador):
Sample Products
Eight products are inserted across the four menu categories. All are seeded without an explicitid_producto, so SQLite’s AUTOINCREMENT assigns IDs 1-8 in insertion order: