t3663: refactor(memory): extract pattern_metadata DDL to eliminate schema duplication#4521
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
…plication (t3663) PR #1629 review (gemini) flagged that the pattern_metadata CREATE TABLE DDL was duplicated between init_db() and migrate_db(). The reviewer's guidance: schema creation belongs in init_db(); migrate_db() should use ALTER TABLE or existence checks, not full DDL. Fix: extract DDL into _create_pattern_metadata_table() — a single authoritative function called from both init_db() (fresh databases) and migrate_db() (existing databases upgrading from pre-t1095 schema). The backfill logic in migrate_db() is unchanged; only the inline CREATE TABLE block is replaced with a helper call. Finding 2 (PATTERN_TYPES_SQL constant) was already resolved in ffa983c — migrate_db() already uses $PATTERN_TYPES_SQL from shared-constants.sh. ShellCheck: zero violations. Closes #3663
d967c25 to
47520f8
Compare
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Mar 14 00:31:48 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
Addresses PR #1629 review feedback (gemini, medium severity) —
pattern_metadataCREATE TABLE DDL was duplicated betweeninit_db()andmigrate_db()in.agents/scripts/memory/_common.sh.Changes
pattern_metadataDDL into_create_pattern_metadata_table()— a single authoritative functioninit_db()calls_create_pattern_metadata_table()after the main heredoc (fresh databases)migrate_db()calls_create_pattern_metadata_table()inside thehas_pattern_metadata == "0"guard (existing databases upgrading from pre-t1095 schema)migrate_db()is unchanged — only the inlineCREATE TABLEblock is replaced with the helper callPATTERN_TYPES_SQLstring) was already resolved inffa983cc— confirmed$PATTERN_TYPES_SQLfromshared-constants.shis usedVerification
CREATE TABLE IF NOT EXISTSis idempotent; both code paths produce the same schemaCloses #3663