[bugfix]: fix schema to ensure 1:1 mapping for conversation_context#107
Conversation
WalkthroughThe database schema for conversation context was updated by renaming the table, removing and modifying several columns, and introducing new timestamp columns. The primary key was changed from a UUID to the user ID. A trigger and function were added to automatically update the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
backend/app/database/supabase/scripts/create_db.sql (1)
1-6: Old plural table is never dropped – risk of stale data & migrations breakingThe previous version of the schema used
conversation_contexts; this statement only dropsconversation_context.
If the old plural table still exists in a target DB, future migrations or seeds may silently read stale rows or fail with duplicate-table errors.-DROP TABLE IF EXISTS conversation_context; +DROP TABLE IF EXISTS conversation_context; +-- Ensure legacy table is also removed +DROP TABLE IF EXISTS conversation_contexts;
🧹 Nitpick comments (1)
backend/app/database/supabase/scripts/create_db.sql (1)
108-119: Minor trigger tidy-ups (optional)
LANGUAGE plpgsqlis the conventional form (no single quotes).- Consider updating
updated_atonly when at least one column actually changes to avoid noisy WAL traffic.-$$ language 'plpgsql'; +$$ LANGUAGE plpgsql;Optional guarded update:
IF NEW IS DISTINCT FROM OLD THEN NEW.updated_at := now(); END IF;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
backend/app/database/supabase/scripts/create_db.sql(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#87
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T23:15:13.374Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer test updates and fixes (like missing imports after module reorganization) to separate PRs rather than expanding the scope of module update/chore PRs to include comprehensive test refactoring.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#90
File: backend/app/agents/devrel/nodes/react_supervisor.py:97-101
Timestamp: 2025-07-05T04:33:39.840Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer code deduplication refactoring (like extracting duplicate functions to shared utilities) until there are more common functionalities present among tools/workflow. With only two files using the same function, they consider it not a problem currently and prefer to "align later in a more better way" once more patterns emerge.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T14:45:55.244Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer comprehensive test refactoring to separate PRs/efforts when doing major backend restructuring, rather than expanding the scope of the current refactoring PR to include test updates.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: backend/app/services/auth/management.py:32-33
Timestamp: 2025-06-28T14:44:36.819Z
Learning: In the Devr.AI project, smokeyScraper prefers using machine timezone (IST) for datetime operations during development and testing for easier debugging, with plans to switch to UTC for deployment later.
Summary by CodeRabbit