Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delete deprecated tables #5833

Merged
merged 4 commits into from
Oct 15, 2024
Merged

Conversation

gurusainath
Copy link
Collaborator

@gurusainath gurusainath commented Oct 15, 2024

  • deleting deprecated models
  • adding external source and external id to models.

Summary by CodeRabbit

  • New Features

    • Introduced external_id and external_source fields to the issue type model for enhanced data storage.
    • Added a new is_locked field to the IssueView for improved view management.
  • Bug Fixes

    • Improved pagination error handling to prevent invalid offsets and limits, ensuring a smoother user experience.
  • Deprecations

    • Removed support for CycleFavorite, ModuleFavorite, PageFavorite, and ProjectFavorite, indicating a restructuring of favorites management.
    • Deprecated GlobalView and IssueViewFavorite, streamlining view functionalities.
  • Documentation

    • Updated documentation to reflect the new fields in the issue type model and changes in pagination methods.

@gurusainath gurusainath self-assigned this Oct 15, 2024
Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

Walkthrough

The changes introduce two new fields, external_id and external_source, to the issuetype model in a Django application, both defined as CharField with a maximum length of 255 characters. The migration also removes several models related to user favorites, indicating a restructuring of how favorites are managed. Additionally, modifications to pagination classes include enhanced error handling and method signature updates to improve robustness and logging within the pagination logic.

Changes

File Path Change Summary
apiserver/plane/db/migrations/0081_issue_external_id_issue_external_source.py Added fields external_id and external_source to the issuetype model. Removed unique constraints and deleted models related to favorites.
apiserver/plane/db/models/__init__.py Removed imports for CycleFavorite, ModuleFavorite, PageFavorite, ProjectFavorite, and IssueViewFavorite.
apiserver/plane/db/models/cycle.py Removed CycleFavorite model.
apiserver/plane/db/models/module.py Removed ModuleFavorite model. Updated Module class constraints formatting.
apiserver/plane/db/models/page.py Removed PageFavorite model. Added deprecation comment for PageBlock.
apiserver/plane/db/models/project.py Removed ProjectFavorite model. Updated workspace field formatting in ProjectBaseModel.
apiserver/plane/db/models/view.py Removed IssueViewFavorite model. Added is_locked field to IssueView.
apiserver/plane/utils/paginator.py Enhanced error handling in pagination classes. Updated method signatures for pagination logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API
    participant Paginator

    User->>API: Request data with pagination
    API->>Paginator: Validate request parameters
    Paginator->>Paginator: Check offset and limit
    Paginator-->>API: Return paginated results
    API-->>User: Send paginated response
Loading

🐇 "In the fields where bunnies roam,
New fields sprout, a data home.
With pagination, errors now tamed,
Our database is nicely framed!
Hops of joy, we celebrate,
For changes made, we elevate!" 🐰

Possibly related PRs

Suggested reviewers

  • NarayanBavisetti
  • pablohashescobar

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (4)
apiserver/plane/db/models/project.py (2)

Line range hint 328-328: Consider removing the extra leading space.

The added space before ordering = ("-created_at",) in the ProjectIdentifier class's Meta is inconsistent with typical Python indentation practices. While it doesn't affect functionality, removing this space would maintain consistency with the rest of the codebase.

-    ordering = ("-created_at",)
+   ordering = ("-created_at",)

ProjectFavorite Removal Incomplete

References to ProjectFavorite still exist in the following areas:

  • Migrations: 0022_auto_20230307_0304.py, 0081_alter_issueviewfavorite_unique_together_and_more.py, 0065_auto_20240415_0937.py
  • Views: ProjectFavoritesViewSet
  • Serializers: ProjectFavoriteLiteSerializer
  • URLs: ProjectFavoritesViewSet endpoints
  • Database Tables: project_favorites related names

Please ensure all dependencies are resolved before removing the ProjectFavorite class.

🔗 Analysis chain

Line range hint 1-328: Verify the impact of removing the ProjectFavorite class.

The removal of the deprecated ProjectFavorite class improves code maintainability. However, it's important to ensure that this removal doesn't negatively impact other parts of the codebase.

Please run the following script to check for any remaining references to the ProjectFavorite class:


Please run the following script to check for any remaining references to the ProjectFavorite class:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the ProjectFavorite class

# Test: Search for ProjectFavorite references
echo "Searching for ProjectFavorite references:"
rg --type python "ProjectFavorite"

# Test: Search for project_favorite references (assuming this was a related_name)
echo "Searching for project_favorite references:"
rg --type python "project_favorite"

Length of output: 320


Script:

# 
#!/bin/bash
# Description: Check for any remaining references to the ProjectFavorite class

# Test: Search for ProjectFavorite references in Python files
echo "Searching for ProjectFavorite references in Python files:"
rg -g "*.py" "ProjectFavorite"

# Test: Search for project_favorite references in Python files
echo "Searching for project_favorite references in Python files:"
rg -g "*.py" "project_favorite"

Length of output: 1815

apiserver/plane/db/migrations/0081_alter_issueviewfavorite_unique_together_and_more.py (2)

12-15: Redundant removal of unique constraints before deleting models

Since the models IssueViewFavorite, ModuleFavorite, PageFavorite, and ProjectFavorite are being deleted later in this migration, removing their unique constraints with AlterUniqueTogether is unnecessary. Deleting the models will automatically remove any associated constraints.

Consider simplifying the migration by removing these AlterUniqueTogether operations.

Also applies to: 40-43, 68-71, 96-99


16-39: Unnecessary field removals before model deletions

The fields are being removed from models that are about to be deleted (IssueViewFavorite, ModuleFavorite, PageFavorite, and ProjectFavorite). This step is redundant because deleting the models will remove all their fields automatically.

You can simplify the migration by omitting the RemoveField operations for these models.

Also applies to: 44-67, 72-95, 100-119

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 26b7e37 and a6f1c65.

📒 Files selected for processing (7)
  • apiserver/plane/db/migrations/0081_alter_issueviewfavorite_unique_together_and_more.py (1 hunks)
  • apiserver/plane/db/models/init.py (3 hunks)
  • apiserver/plane/db/models/cycle.py (0 hunks)
  • apiserver/plane/db/models/module.py (1 hunks)
  • apiserver/plane/db/models/page.py (0 hunks)
  • apiserver/plane/db/models/project.py (1 hunks)
  • apiserver/plane/db/models/view.py (1 hunks)
💤 Files with no reviewable changes (2)
  • apiserver/plane/db/models/cycle.py
  • apiserver/plane/db/models/page.py
✅ Files skipped from review due to trivial changes (1)
  • apiserver/plane/db/models/module.py
🧰 Additional context used
🪛 Ruff
apiserver/plane/db/models/__init__.py

5-5: .cycle.Cycle imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleIssue imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleUserProperties imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


72-72: .view.IssueView imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


87-87: Redefinition of unused Page from line 53

Remove definition: Page

(F811)


87-87: .page.Page imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


87-87: Redefinition of unused PageLog from line 55

Remove definition: PageLog

(F811)


87-87: .page.PageLog imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


87-87: Redefinition of unused PageLabel from line 54

Remove definition: PageLabel

(F811)


87-87: .page.PageLabel imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

🔇 Additional comments (8)
apiserver/plane/db/models/__init__.py (3)

72-72: Verify usage of IssueView import

The removal of IssueViewFavorite is consistent with the restructuring of favorites management. However, static analysis suggests that IssueView might be unused.

Please verify if this import is still needed elsewhere in the codebase. If it is indeed unused, consider removing it to keep the imports clean and prevent potential issues with dead code.

To verify the usage of this import, you can run the following script:

#!/bin/bash
# Description: Check for usage of IssueView

echo "Checking usage of IssueView:"
rg --type python "IssueView(?!\w)" --glob '!apiserver/plane/db/models/__init__.py'

If the script returns no results, it's safe to remove the import.

🧰 Tools
🪛 Ruff

72-72: .view.IssueView imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


Line range hint 1-108: Final review summary

The changes in this file align with the PR objectives of restructuring how favorites are managed. The removal of favorite-related imports is consistent across different modules. However, there are a few areas that could use some attention:

  1. Potential unused imports from the cycle and view modules.
  2. Redundant imports from the page module.

To ensure the cleanest possible import structure, I recommend the following steps:

  1. Verify the usage of potentially unused imports as suggested in the previous comments.
  2. Remove the redundant page module imports.
  3. After making these changes, run a final check to ensure no new issues are introduced.

You can use the following script to perform a final verification of the import structure:

#!/bin/bash
# Description: Verify the import structure of the __init__.py file

echo "Checking for unused imports:"
ruff check apiserver/plane/db/models/__init__.py --select F401

echo "Checking for duplicate imports:"
ruff check apiserver/plane/db/models/__init__.py --select F811

This will help ensure that all imports are necessary and not duplicated.

🧰 Tools
🪛 Ruff

2-2: .api.APIActivityLog imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


2-2: .api.APIToken imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


3-3: .asset.FileAsset imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


4-4: .base.BaseModel imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.Cycle imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleIssue imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleUserProperties imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


8-8: .draft.DraftIssue imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


8-8: .draft.DraftIssueAssignee imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


8-8: .draft.DraftIssueLabel imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


8-8: .draft.DraftIssueModule imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


8-8: .draft.DraftIssueCycle imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: Verify usage of cycle module imports

The removal of CycleFavorite is consistent with the restructuring of favorites management. However, static analysis suggests that Cycle, CycleIssue, and CycleUserProperties might be unused.

Please verify if these imports are still needed elsewhere in the codebase. If they are indeed unused, consider removing them to keep the imports clean and prevent potential issues with dead code.

To verify the usage of these imports, you can run the following script:

If the script returns no results for any of these classes, it's safe to remove the corresponding import.

🧰 Tools
🪛 Ruff

5-5: .cycle.Cycle imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleIssue imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


5-5: .cycle.CycleUserProperties imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

apiserver/plane/db/models/view.py (2)

Line range hint 1-55: Address implications of removing IssueViewFavorite class.

The removal of the IssueViewFavorite class indicates a significant change in how favorites are managed in the application. While this change is not visible in the provided code snippet, it's important to address its implications.

Please consider the following points:

  1. Ensure there's a migration strategy in place for existing favorites data. If this data needs to be preserved, consider how it will be transferred or handled in the new system.

  2. Update any views, serializers, API endpoints, and other components that previously interacted with the IssueViewFavorite model. This includes removing or modifying any code that references this model.

  3. Review and update the documentation related to favorites functionality, reflecting the new approach to managing favorites (if any).

  4. If favorites functionality is being replaced by a new system, ensure that the new implementation is thoroughly tested and provides equivalent or improved functionality.

To help identify areas that might need updates, you can run the following script:

#!/bin/bash
# Description: Identify potential areas affected by the removal of IssueViewFavorite

# Test: Search for IssueViewFavorite usage across the project
echo "Searching for IssueViewFavorite usage:"
rg --type python "IssueViewFavorite" -g "!*/migrations/*"

# Test: Check for any remaining migrations related to IssueViewFavorite
echo "Checking for IssueViewFavorite migrations:"
rg --type python "IssueViewFavorite" -g "*/migrations/*"

Please provide more context on how favorites will be managed going forward, or if this functionality is being deprecated entirely.


55-55: Approve addition of is_locked field with suggestions.

The addition of the is_locked field to the IssueView model is a good enhancement. It allows for the implementation of a view locking feature, which can be useful for preserving important or frequently used views.

Consider the following suggestions:

  1. Update any existing queries, forms, and API endpoints that interact with the IssueView model to handle this new field appropriately.
  2. Add documentation explaining the purpose and usage of this new feature, including any UI changes that might be necessary to support view locking.
  3. Consider adding a migration to set the initial value of is_locked for existing records, if necessary.

To ensure all necessary updates have been made, you can run the following script:

apiserver/plane/db/models/project.py (2)

184-186: LGTM: Improved readability of workspace field definition.

The multi-line format for the workspace field improves code readability without changing functionality. This change adheres to PEP 8 style guidelines for line length.


Line range hint 1-328: Summary of changes

  1. The workspace field in ProjectBaseModel has been reformatted for better readability.
  2. The deprecated ProjectFavorite class has been removed.
  3. There's a minor formatting change in the ProjectIdentifier class.

Overall, these changes improve code readability and maintainability without introducing new functionality. Please ensure that the removal of ProjectFavorite doesn't have unintended consequences in other parts of the codebase.

apiserver/plane/db/migrations/0081_alter_issueviewfavorite_unique_together_and_more.py (1)

120-129: Ensure new fields in IssueType handle existing data appropriately

Adding external_id and external_source to the IssueType model without default values could impact existing records if the application or database expects these fields to be non-null. Although the fields allow null=True and blank=True, it's important to verify that this change doesn't introduce issues in data integrity or application logic.

Please confirm that existing instances of IssueType are compatible with these new fields and that the application handles cases where these fields are null.

@@ -87,7 +84,7 @@

from .importer import Importer

from .page import Page, PageLog, PageFavorite, PageLabel
from .page import Page, PageLog, PageLabel
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove redundant page module imports

The imports of Page, PageLog, and PageLabel on this line are redundant as they are already imported earlier in the file (around lines 53-55).

To clean up the imports and avoid potential confusion, please remove this line entirely. Here's the suggested change:

- from .page import Page, PageLog, PageLabel

This will help maintain a cleaner and more organized import structure.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from .page import Page, PageLog, PageLabel
🧰 Tools
🪛 Ruff

87-87: Redefinition of unused Page from line 53

Remove definition: Page

(F811)


87-87: .page.Page imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


87-87: Redefinition of unused PageLog from line 55

Remove definition: PageLog

(F811)


87-87: .page.PageLog imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


87-87: Redefinition of unused PageLabel from line 54

Remove definition: PageLabel

(F811)


87-87: .page.PageLabel imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

Comment on lines 130 to 144
migrations.DeleteModel(
name="CycleFavorite",
),
migrations.DeleteModel(
name="IssueViewFavorite",
),
migrations.DeleteModel(
name="ModuleFavorite",
),
migrations.DeleteModel(
name="PageFavorite",
),
migrations.DeleteModel(
name="ProjectFavorite",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential data loss from deleting models

Deleting models CycleFavorite, IssueViewFavorite, ModuleFavorite, PageFavorite, and ProjectFavorite will permanently remove all associated data. If this data is still needed or valuable for analytics, user experience, or compliance purposes, consider performing a data migration to archive or transfer the data before deletion.

Would you like assistance in creating a data migration to preserve the existing data before dropping these models?

@sriramveeraghanta sriramveeraghanta changed the title chore: external source and id for issues chore: delete deprecated tables Oct 15, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a6f1c65 and c097a55.

📒 Files selected for processing (3)
  • apiserver/plane/db/migrations/0081_remove_globalview_created_by_and_more.py (1 hunks)
  • apiserver/plane/db/models/page.py (0 hunks)
  • apiserver/plane/db/models/view.py (0 hunks)
💤 Files with no reviewable changes (2)
  • apiserver/plane/db/models/page.py
  • apiserver/plane/db/models/view.py
🧰 Additional context used
🔇 Additional comments (2)
apiserver/plane/db/migrations/0081_remove_globalview_created_by_and_more.py (2)

166-186: Confirm that deleting models does not impact data integrity

Deleting models like CycleFavorite, GlobalView, etc., could impact existing data and relationships.

  • Data Backup: Ensure that any important data in these models has been backed up or migrated if necessary.
  • Foreign Key Constraints: Check for any models that might have foreign key relationships to these models.

Run the following script to identify potential foreign key dependencies:

#!/bin/bash
# Description: Identify models that reference the deleted models.

# Test: Search for foreign key relationships. Expect: No remaining references.
grep -rE '(ForeignKey|OneToOneField|ManyToManyField)\(.*(CycleFavorite|GlobalView|IssueViewFavorite|ModuleFavorite|PageBlock|PageFavorite|ProjectFavorite)' apiserver/plane/db/models/

156-165: Ensure new fields in issuetype model have appropriate attributes

The fields external_id and external_source are added to the issuetype model. Since these fields might be used for integration with external systems, consider the following:

  • Max Length: Is 255 characters sufficient for external_id and external_source? Ensure this length accommodates all expected external identifiers.
  • Indexing: If queries will be performed frequently on these fields, consider adding indexes to improve query performance.

Run the following script to check for any existing usages that might be impacted:

Comment on lines +24 to +27
migrations.AlterUniqueTogether(
name="issueviewfavorite",
unique_together=None,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Unnecessary AlterUniqueTogether before model deletion

The unique constraint for IssueViewFavorite is being altered before the model is deleted. Since the model is being deleted, modifying its constraints is redundant.

Consider removing the AlterUniqueTogether operation for IssueViewFavorite. This streamlines the migration and prevents unnecessary steps.

Apply this diff to remove the operation:

-        migrations.AlterUniqueTogether(
-            name="issueviewfavorite",
-            unique_together=None,
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.AlterUniqueTogether(
name="issueviewfavorite",
unique_together=None,
),

Comment on lines +108 to +131
migrations.RemoveField(
model_name="pagefavorite",
name="created_by",
),
migrations.RemoveField(
model_name="pagefavorite",
name="page",
),
migrations.RemoveField(
model_name="pagefavorite",
name="project",
),
migrations.RemoveField(
model_name="pagefavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="pagefavorite",
name="user",
),
migrations.RemoveField(
model_name="pagefavorite",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals from PageFavorite

Fields are being removed before deleting PageFavorite.

Exclude the RemoveField operations for PageFavorite.

Apply this diff:

-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="page",
-        ),
-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="project",
-        ),
-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="user",
-        ),
-        migrations.RemoveField(
-            model_name="pagefavorite",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="pagefavorite",
name="created_by",
),
migrations.RemoveField(
model_name="pagefavorite",
name="page",
),
migrations.RemoveField(
model_name="pagefavorite",
name="project",
),
migrations.RemoveField(
model_name="pagefavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="pagefavorite",
name="user",
),
migrations.RemoveField(
model_name="pagefavorite",
name="workspace",
),

Comment on lines +104 to +107
migrations.AlterUniqueTogether(
name="pagefavorite",
unique_together=None,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Unnecessary AlterUniqueTogether before model deletion

For PageFavorite, altering unique constraints before deleting the model is not needed.

Remove the AlterUniqueTogether operation for PageFavorite.

Apply this diff:

-        migrations.AlterUniqueTogether(
-            name="pagefavorite",
-            unique_together=None,
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.AlterUniqueTogether(
name="pagefavorite",
unique_together=None,
),

Comment on lines +80 to +103
migrations.RemoveField(
model_name="pageblock",
name="created_by",
),
migrations.RemoveField(
model_name="pageblock",
name="issue",
),
migrations.RemoveField(
model_name="pageblock",
name="page",
),
migrations.RemoveField(
model_name="pageblock",
name="project",
),
migrations.RemoveField(
model_name="pageblock",
name="updated_by",
),
migrations.RemoveField(
model_name="pageblock",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals from PageBlock

Fields are being individually removed from PageBlock prior to deletion.

Remove the RemoveField operations for PageBlock.

Apply this diff:

-        migrations.RemoveField(
-            model_name="pageblock",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="pageblock",
-            name="issue",
-        ),
-        migrations.RemoveField(
-            model_name="pageblock",
-            name="page",
-        ),
-        migrations.RemoveField(
-            model_name="pageblock",
-            name="project",
-        ),
-        migrations.RemoveField(
-            model_name="pageblock",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="pageblock",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="pageblock",
name="created_by",
),
migrations.RemoveField(
model_name="pageblock",
name="issue",
),
migrations.RemoveField(
model_name="pageblock",
name="page",
),
migrations.RemoveField(
model_name="pageblock",
name="project",
),
migrations.RemoveField(
model_name="pageblock",
name="updated_by",
),
migrations.RemoveField(
model_name="pageblock",
name="workspace",
),

Comment on lines +12 to +23
migrations.RemoveField(
model_name="globalview",
name="created_by",
),
migrations.RemoveField(
model_name="globalview",
name="updated_by",
),
migrations.RemoveField(
model_name="globalview",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals before model deletion

The fields from GlobalView are being removed individually before the model is deleted later in the migration. This is unnecessary as deleting the model will automatically remove all its fields.

Consider simplifying the migration by removing the individual RemoveField operations for GlobalView and directly deleting the model. This reduces the migration steps and avoids potential issues during rollback.

Apply this diff to remove the redundant operations:

-        migrations.RemoveField(
-            model_name="globalview",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="globalview",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="globalview",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="globalview",
name="created_by",
),
migrations.RemoveField(
model_name="globalview",
name="updated_by",
),
migrations.RemoveField(
model_name="globalview",
name="workspace",
),

Comment on lines +52 to +55
migrations.AlterUniqueTogether(
name="modulefavorite",
unique_together=None,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Unnecessary AlterUniqueTogether before model deletion

The same issue applies to ModuleFavorite. Altering unique constraints before deleting the model is redundant.

Remove the AlterUniqueTogether operation for ModuleFavorite.

Apply this diff:

-        migrations.AlterUniqueTogether(
-            name="modulefavorite",
-            unique_together=None,
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.AlterUniqueTogether(
name="modulefavorite",
unique_together=None,
),

Comment on lines +56 to +79
migrations.RemoveField(
model_name="modulefavorite",
name="created_by",
),
migrations.RemoveField(
model_name="modulefavorite",
name="module",
),
migrations.RemoveField(
model_name="modulefavorite",
name="project",
),
migrations.RemoveField(
model_name="modulefavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="modulefavorite",
name="user",
),
migrations.RemoveField(
model_name="modulefavorite",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals from ModuleFavorite

Fields are being removed before deleting ModuleFavorite.

Omit the RemoveField operations for ModuleFavorite.

Apply this diff:

-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="module",
-        ),
-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="project",
-        ),
-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="user",
-        ),
-        migrations.RemoveField(
-            model_name="modulefavorite",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="modulefavorite",
name="created_by",
),
migrations.RemoveField(
model_name="modulefavorite",
name="module",
),
migrations.RemoveField(
model_name="modulefavorite",
name="project",
),
migrations.RemoveField(
model_name="modulefavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="modulefavorite",
name="user",
),
migrations.RemoveField(
model_name="modulefavorite",
name="workspace",
),

Comment on lines +136 to +155
migrations.RemoveField(
model_name="projectfavorite",
name="created_by",
),
migrations.RemoveField(
model_name="projectfavorite",
name="project",
),
migrations.RemoveField(
model_name="projectfavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="projectfavorite",
name="user",
),
migrations.RemoveField(
model_name="projectfavorite",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals from ProjectFavorite

Fields are being removed from ProjectFavorite before its deletion.

Remove the RemoveField operations for ProjectFavorite.

Apply this diff:

-        migrations.RemoveField(
-            model_name="projectfavorite",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="projectfavorite",
-            name="project",
-        ),
-        migrations.RemoveField(
-            model_name="projectfavorite",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="projectfavorite",
-            name="user",
-        ),
-        migrations.RemoveField(
-            model_name="projectfavorite",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="projectfavorite",
name="created_by",
),
migrations.RemoveField(
model_name="projectfavorite",
name="project",
),
migrations.RemoveField(
model_name="projectfavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="projectfavorite",
name="user",
),
migrations.RemoveField(
model_name="projectfavorite",
name="workspace",
),

Comment on lines +132 to +135
migrations.AlterUniqueTogether(
name="projectfavorite",
unique_together=None,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Unnecessary AlterUniqueTogether before model deletion

The AlterUniqueTogether operation for ProjectFavorite is unnecessary before model deletion.

Remove this operation to simplify the migration.

Apply this diff:

-        migrations.AlterUniqueTogether(
-            name="projectfavorite",
-            unique_together=None,
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.AlterUniqueTogether(
name="projectfavorite",
unique_together=None,
),

Comment on lines +28 to +51
migrations.RemoveField(
model_name="issueviewfavorite",
name="created_by",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="project",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="user",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="view",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="workspace",
),
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Redundant field removals from IssueViewFavorite

Similar to GlobalView, fields are being removed from IssueViewFavorite before deleting the model. This is unnecessary.

Remove the individual RemoveField operations for IssueViewFavorite and proceed directly to deleting the model.

Apply this diff:

-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="created_by",
-        ),
-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="project",
-        ),
-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="updated_by",
-        ),
-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="user",
-        ),
-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="view",
-        ),
-        migrations.RemoveField(
-            model_name="issueviewfavorite",
-            name="workspace",
-        ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
migrations.RemoveField(
model_name="issueviewfavorite",
name="created_by",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="project",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="updated_by",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="user",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="view",
),
migrations.RemoveField(
model_name="issueviewfavorite",
name="workspace",
),

@sriramveeraghanta sriramveeraghanta merged commit cc613e5 into preview Oct 15, 2024
13 of 15 checks passed
@sriramveeraghanta sriramveeraghanta deleted the external-fields-for-issues branch October 15, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants