Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Implements the Week 12 assignment tasks: SQL queries for the books database (task-1) and refactoring the flashcard app’s storage layer from JSON to SQLite (task-2).
Changes:
- Implemented the SQLite-backed storage functions in
task-2/src/database.js. - Added initial DB schema (
task-2/setup.sql) and a JSON→SQLite migration script (task-2/migrate.js). - Added task deliverables/assets (SQL queries, lockfile, SQLite DB files, root
package.json).
Reviewed changes
Copilot reviewed 5 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| task-2/src/database.js | Implements deck/card CRUD using better-sqlite3 queries. |
| task-2/setup.sql | Adds SQLite DDL for decks and cards tables. |
| task-2/migrate.js | Adds a script to migrate data/data.json into SQLite tables. |
| task-2/package-lock.json | Locks better-sqlite3 dependency versions for task-2. |
| task-2/data/flashcards.db | Adds a generated SQLite DB file containing migrated flashcard data. |
| task-1/queries.sql | Adds answers for the required SQL queries. |
| task-1/books_library.db | Adds/updates the SQLite database used by task-1. |
| package.json | Adds a root-level Node package manifest. |
Files not reviewed (1)
- task-2/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| -- **Question 6** — Add one book for the author you just inserted. It can be a real book or a made-up one. | ||
| INSERT INTO books( | ||
| title, published_year, genre, author_id) | ||
| VALUES('Fikir Eske Mekabir', 1968, 'Tragedy/Romance', 25); |
There was a problem hiding this comment.
Question 6 hard-codes author_id = 25, which will only work if the newly inserted author happens to get id 25. To reliably link the new book to the author inserted in Question 5, derive the id via a subquery (e.g., lookup by the inserted author’s name) instead of relying on a fixed id.
| VALUES('Fikir Eske Mekabir', 1968, 'Tragedy/Romance', 25); | |
| VALUES( | |
| 'Fikir Eske Mekabir', | |
| 1968, | |
| 'Tragedy/Romance', | |
| (SELECT id FROM authors WHERE first_name = 'Haddis' AND last_name = 'Alemayehu') | |
| ); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
complete: Task1 & 2.