Skip to content

fix(database): add migration for missing contact_private_info table#726

Closed
thepastaclaw wants to merge 1 commit intodashpay:v1.0-devfrom
thepastaclaw:fix/missing-contact-private-info-migration
Closed

fix(database): add migration for missing contact_private_info table#726
thepastaclaw wants to merge 1 commit intodashpay:v1.0-devfrom
thepastaclaw:fix/missing-contact-private-info-migration

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw commented Mar 10, 2026

Issue

Fixes #686

Description

Users with existing databases get "no such table: contact_private_info" errors because contact_private_info was only created in create_tables() (fresh installs) but had no migration step in apply_version_changes().

Fix

Added migration version 29 that calls init_contacts_tables(). Uses CREATE TABLE IF NOT EXISTS so it's idempotent and safe for all database states (fresh installs already have the table; upgraders will get it via migration).

Testing

  • cargo check
  • All 41 database tests pass

Summary by CodeRabbit

  • Chores
    • Updated database to version 29 with refined migration handling for data initialization.

The contact_private_info table was created in create_tables() for fresh
installs but had no corresponding migration step. Users with existing
databases upgrading from any version would hit 'no such table:
contact_private_info' when trying to save contact details or profiles.

Add migration version 28 that calls init_contacts_tables() to create the
table for existing databases.

Fixes dashpay#686
@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 356a0732-9c89-40b9-a7d0-c8cd4862f6c0

📥 Commits

Reviewing files that changed from the base of the PR and between 768a834 and 3812b9d.

📒 Files selected for processing (1)
  • src/database/initialization.rs

📝 Walkthrough

Walkthrough

Database default version bumped from 28 to 29. The init_contacts_tables() initialization call is relocated from the version 28 migration path to a new version 29 path, deferring table creation to the later migration version. This addresses table initialization sequencing in the database schema.

Changes

Cohort / File(s) Summary
Database Version & Migration Logic
src/database/initialization.rs
Incremented DEFAULT_DB_VERSION constant from 28 to 29; relocated init_contacts_tables(tx) call from version 28 branch to newly added version 29 migration path to defer contact table initialization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 From v28 to v29 we hopscotch true,
Tables sprout where they ought to grew,
Contacts saved through migration's song,
Database woes corrected long! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a migration for the missing contact_private_info table.
Linked Issues check ✅ Passed The PR addresses issue #686 by implementing a migration to ensure the contact_private_info table exists for upgraded databases.
Out of Scope Changes check ✅ Passed All changes are directly related to the migration objective; only the database version constant and migration logic were modified.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lklimek
Copy link
Copy Markdown
Contributor

lklimek commented Mar 11, 2026

already fixed in base branch, v28

@lklimek lklimek closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

failed to save Public Profile: no such table: contact_private_info

2 participants