[WIKI-619] chore: added sort order migration for page model#7673
[WIKI-619] chore: added sort order migration for page model#7673sriramveeraghanta merged 1 commit intopreviewfrom
Conversation
WalkthroughAdds Page.sort_order (FloatField, default 65535). Introduces Pagelog.entity_type (CharField, nullable/blank, max_length=30). Updates Pagelog.entity_identifier to UUIDField allowing null and blank. Corresponding Django model and migration changes are included. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds database model changes to support page sorting and enhanced page logging functionality by introducing two new fields across the Page and PageLog models.
- Added
sort_orderfield to Page model for ordering functionality - Added
entity_typefield to PageLog model for better categorization of log entries - Modified
entity_identifierfield in PageLog model to allow blank values
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/api/plane/db/models/page.py | Adds sort_order field to Page model and entity_type field to PageLog model, plus modifies entity_identifier to allow blank values |
| apps/api/plane/db/migrations/0102_page_sort_order_pagelog_entity_type_and_more.py | Django migration file implementing the database schema changes for the new fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/api/plane/db/models/page.py (1)
104-104: Constrain entity_type (choices) and index for filteringDefine canonical choices (TextChoices) to prevent drift and add an index if used in analytics/filters.
Apply:
- entity_type = models.CharField(max_length=30, verbose_name="Entity Type", null=True, blank=True) + class EntityType(models.TextChoices): + ISSUE = "issue", "Issue" + IMAGE = "image", "Image" + VIDEO = "video", "Video" + FILE = "file", "File" + LINK = "link", "Link" + CYCLE = "cycle", "Cycle" + MODULE = "module", "Module" + PAGE_MENTION = "page_mention", "Page Mention" + USER_MENTION = "user_mention", "User Mention" + + entity_type = models.CharField( + max_length=30, + choices=EntityType.choices, + verbose_name="Entity Type", + null=True, + blank=True, + db_index=True, + )If choices must remain open-ended, at least keep db_index=True.
apps/api/plane/db/migrations/0102_page_sort_order_pagelog_entity_type_and_more.py (1)
18-24: Index entity_type (frequent filter) or keep it nullable-only if purely descriptiveAdd db_index for common filtering.
- migrations.AddField( - model_name="pagelog", - name="entity_type", - field=models.CharField( - blank=True, max_length=30, null=True, verbose_name="Entity Type" - ), - ), + migrations.AddField( + model_name="pagelog", + name="entity_type", + field=models.CharField( + blank=True, max_length=30, null=True, verbose_name="Entity Type", db_index=True + ), + ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/api/plane/db/migrations/0102_page_sort_order_pagelog_entity_type_and_more.py(1 hunks)apps/api/plane/db/models/page.py(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/api/plane/db/models/page.py (1)
102-102: Add index to entity_identifier on Page model--- a/apps/api/plane/db/models/page.py +++ b/apps/api/plane/db/models/page.py @@ line 102 - entity_identifier = models.UUIDField(null=True, blank=True) + entity_identifier = models.UUIDField(null=True, blank=True, db_index=True)
- Ensure migrations include this field’s creation (no matching migration found for
entity_identifier); confirm the existing column is already UUID typed before deploying (add cast/cleanup migration if needed).apps/api/plane/db/migrations/0102_page_sort_order_pagelog_entity_type_and_more.py (1)
25-29: Safe-cast suggestion is unnecessary:page_logs.entity_identifierhas been a UUID column since migration 0048, so there’s no type conversion or data cleanup required.Likely an incorrect or invalid review comment.
Description
this pull request adds a new field in the page model called
sort_orderand one more new field called entity_type in the page log model.Type of Change
Summary by CodeRabbit