Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/db/schema/quiz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export const quizAttempts = pgTable(
.defaultNow(),
},
table => ({
userIdIdx: index('quiz_attempts_user_id_idx').on(table.userId), // ← NEW
quizIdIdx: index('quiz_attempts_quiz_id_idx').on(table.quizId),
userCompletedAtIdx: index('quiz_attempts_user_completed_at_idx').on(
table.userId,
table.completedAt
Expand Down
2 changes: 2 additions & 0 deletions frontend/drizzle/0013_warm_dexter_bennett.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE INDEX "quiz_attempts_user_id_idx" ON "quiz_attempts" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "quiz_attempts_quiz_id_idx" ON "quiz_attempts" USING btree ("quiz_id");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "992ea1db-8b0c-48b9-ad60-7d268b6284c0",
"prevId": "0e73615b-1aef-44f4-b3bb-42ad793a8541",
"id": "7f528773-4966-47d2-85a4-5f3c2f62fec6",
"prevId": "ff80403e-b315-4f2a-b266-86853ee4c859",
"version": "7",
"dialect": "postgresql",
"tables": {
Expand Down Expand Up @@ -573,6 +573,36 @@
}
},
"indexes": {
"quiz_attempts_user_id_idx": {
"name": "quiz_attempts_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"quiz_attempts_quiz_id_idx": {
"name": "quiz_attempts_quiz_id_idx",
"columns": [
{
"expression": "quiz_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"quiz_attempts_user_completed_at_idx": {
"name": "quiz_attempts_user_completed_at_idx",
"columns": [
Expand Down Expand Up @@ -1338,6 +1368,20 @@
"primaryKey": false,
"notNull": true
},
"selected_size": {
"name": "selected_size",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"selected_color": {
"name": "selected_color",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
Comment on lines +1371 to +1384

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Snapshot includes order_items schema changes not present in migration SQL.

This snapshot shows new columns in the order_items table:

  • selected_size (text, not null, default '')
  • selected_color (text, not null, default '')

And an updated unique index order_items_order_variant_uq that includes these new columns (lines 1450-1476).

However, the migration file frontend/drizzle/0013_warm_dexter_bennett.sql contains ONLY the quiz_attempts index creation statements—no ALTER TABLE commands for order_items.

This inconsistency means:

  • Applying migration 0013 will create quiz indexes but NOT the order_items columns
  • The schema/snapshot will be out of sync with the actual database state
  • Subsequent migrations or schema introspection may fail

Please verify:

  1. Are the order_items changes supposed to be in this migration? If so, the SQL file is incomplete.
  2. Are they from a different migration? If so, the snapshot may be incorrectly generated.
  3. Was this snapshot accidentally created from a different branch or state?
#!/bin/bash
# Check if order_items schema changes exist in any migration files

echo "=== Searching for order_items ALTER statements in migration files ==="
rg -n "ALTER TABLE.*order_items|selected_size|selected_color" frontend/drizzle/*.sql

echo -e "\n=== Check if order_items schema in TypeScript includes these columns ==="
rg -n "selected_size|selected_color" frontend/db/schema/ -A 2 -B 2

echo -e "\n=== List all migration files to identify where order_items changes belong ==="
ls -la frontend/drizzle/*.sql

Also applies to: 1450-1476

🤖 Prompt for AI Agents
In @frontend/drizzle/meta/0013_snapshot.json around lines 1371 - 1384, The
snapshot shows order_items additions (columns selected_size and selected_color
and updated unique index order_items_order_variant_uq) but the migration file
0013_warm_dexter_bennett.sql only contains quiz_attempts index DDL; reconcile by
either (A) adding the missing ALTER TABLE ... ADD COLUMN ... NOT NULL DEFAULT ''
statements and the ALTER INDEX/CREATE UNIQUE INDEX/update for
order_items_order_variant_uq into 0013_warm_dexter_bennett.sql (ensuring SQL
matches the snapshot column types/defaults and index definition), or (B) if
those order_items changes belong to a different migration/branch, regenerate or
revert frontend/drizzle/meta/0013_snapshot.json so it matches the actual
migrations (remove selected_size/selected_color and index changes), and run the
ripgrep checks suggested (search for selected_size/selected_color and ALTER
TABLE order_items) to confirm no stray DDL is missing or duplicated; update the
migration or snapshot accordingly and re-run schema generation/tests.

"quantity": {
"name": "quantity",
"type": "integer",
Expand Down Expand Up @@ -1403,8 +1447,8 @@
"method": "btree",
"with": {}
},
"order_items_order_product_uq": {
"name": "order_items_order_product_uq",
"order_items_order_variant_uq": {
"name": "order_items_order_variant_uq",
"columns": [
{
"expression": "order_id",
Expand All @@ -1417,6 +1461,18 @@
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "selected_size",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "selected_color",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
Expand Down
7 changes: 7 additions & 0 deletions frontend/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@
"when": 1767664985434,
"tag": "0012_inventory_moves_product_fk_restrict",
"breakpoints": true
},
{
"idx": 13,
"version": "7",
"when": 1767693499602,
"tag": "0013_warm_dexter_bennett",
"breakpoints": true
}
]
}
11 changes: 0 additions & 11 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions json/quizzes/html/advanced/html-advanced-quiz-part3.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@
"difficulty": "medium",
"uk": {
"q": "Яке значення мають заголовки h1-h6 для SEO?",
"exp": "<h1> — головний заголовок, має бути один на сторінці, сигналізує основну тему. <h2>-<h6> структурують контент ієрархічно. Використання ключових слів у заголовках покращує релевантність."
"exp": "<h1> — головний заголовок, рекомендовано один на сторінку для SEO (хоча HTML5 дозволяє кілька в межах секцій). <h2>-<h6> структурують контент ієрархічно. Використання ключових слів у заголовках покращує релевантність."
},
"en": {
"q": "What importance do h1-h6 headings have for SEO?",
"exp": "<h1> is the main heading, should be one per page, signals main topic. <h2>-<h6> structure content hierarchically. Using keywords in headings improves relevance."
"exp": "<h1> is the main heading, one per page is recommended for SEO (though HTML5 allows multiple within sections). <h2>-<h6> structure content hierarchically. Using keywords in headings improves relevance."
},
"pl": {
"q": "Jakie znaczenie mają nagłówki h1-h6 dla SEO?",
"exp": "<h1> to główny nagłówek, powinien być jeden na stronie, sygnalizuje główny temat. <h2>-<h6> strukturyzują treść hierarchicznie. Używanie słów kluczowych w nagłówkach poprawia trafność."
"exp": "<h1> to główny nagłówek, jeden na stronę jest zalecany dla SEO (choć HTML5 pozwala na wiele w sekcjach). <h2>-<h6> strukturyzują treść hierarchicznie. Używanie słów kluczowych w nagłówkach poprawia trafność."
},
"answers": [
{
Expand All @@ -239,15 +239,15 @@
"correct": false
},
{
"uk": "h1 один на сторінку, ієрархія h2-h6 структурує контент для пошуковиків",
"en": "h1 one per page, h2-h6 hierarchy structures content for search engines",
"pl": "h1 jeden na stronę, hierarchia h2-h6 strukturyzuje treść dla wyszukiwarek",
"uk": "h1 рекомендовано один на сторінку, ієрархія h2-h6 структурує контент",
"en": "h1 recommended one per page, h2-h6 hierarchy structures content",
"pl": "h1 zalecany jeden na stronę, hierarchia h2-h6 strukturyzuje treść",
"correct": true
},
{
"uk": "Можна використовувати кілька h1 на сторінці",
"en": "Can use multiple h1 on a page",
"pl": "Można używać wielu h1 na stronie",
"uk": "Кілька h1 — найкраща практика для SEO",
"en": "Multiple h1 is best practice for SEO",
"pl": "Wiele h1 to najlepsza praktyka dla SEO",
"correct": false
},
{
Expand Down