Skip to content

Fix: ensure tenant_ocr_id is added - #18560

Merged
wangq8 merged 3 commits into
infiniflow:mainfrom
Lynn-Inf:fix/migrate-from-old
Aug 20, 2026
Merged

wangq8 merged 3 commits into
infiniflow:mainfrom
Lynn-Inf:fix/migrate-from-old

Conversation

@Lynn-Inf

Copy link
Copy Markdown
Contributor

Summary

As title.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Aug 20, 2026
@Lynn-Inf
Lynn-Inf requested a review from wangq8 August 20, 2026 07:49
@Lynn-Inf Lynn-Inf added the ci Continue Integration label Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: be3a463d-b709-49d1-97c5-e3377125636f

📥 Commits

Reviewing files that changed from the base of the PR and between d76c15e and 36be2ef.

📒 Files selected for processing (1)
  • api/db/db_models.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The database migration now adds the nullable, indexed tenant_ocr_id column to the tenant table. Its definition matches the existing Tenant.tenant_ocr_id model field.

Changes

Tenant schema alignment

Layer / File(s) Summary
Add tenant OCR ID column
api/db/db_models.py
migrate_db() adds tenant_ocr_id as an indexed nullable CharField with a maximum length of 32.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 36be2

This localized change has no actionable merge-blocking risk remaining and is merge-ready after normal checks and review.

Suggested reviewers: kevinhush, jinhai-cn, euvre

Poem

I’m a rabbit with a schema to mend,
A tenant field joins its table friend.
Indexed and small, nullable too,
The migration makes the model true.
Hop, hop—alignment comes through!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Description check ❓ Inconclusive The description includes the required Summary heading but provides no meaningful explanation beyond referring to the title. Describe the migration change, its background, and the tenant_ocr_id or tenant_llm issue that this PR resolves.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the migration fix that adds tenant_ocr_id.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (618c459) to head (36be2ef).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18560   +/-   ##
=======================================
  Coverage   90.65%   90.65%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          650      650           
  Misses         39       39           
  Partials       28       28           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix. This looks correct and complete.

Verification

  • Tenant.tenant_ocr_id is declared in the model (CharField(max_length=32, null=True, help_text="id in tenant_model", index=True)), but it was missing from migrate_db(), so existing deployments never got the column while fresh installs (which create the full model) did — leading to inconsistent schema and runtime failures when a tenant OCR model is configured.
  • The added migration matches the model definition exactly (max_length=32, null=True, index=True), consistent with the sibling tenant_*_id columns.
  • alter_db_add_column is idempotent (it catches and skips duplicate-column errors), so this is safe to run on both fresh installs and existing databases.
  • Placement directly after the existing ocr_id migration is a sensible grouping.

Minor note (pre-existing, out of scope)

  • The existing ocr_id migration uses max_length=128 while the model declares max_length=256. That's unrelated to this PR, but you may want a follow-up to align them.

Nothing blocking; looks good to me.

@wangq8
wangq8 merged commit f7a2848 into infiniflow:main Aug 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants