-
Notifications
You must be signed in to change notification settings - Fork 740
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
Drop unused columns and tables in database #2750
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis migration script performs a comprehensive database cleanup by removing multiple unused tables and obsolete columns from the Changes
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
backend/src/database/migrations/V1736414839__cleanupUnusedTablesAndColumns.sql (1)
1-52
: Consider adding a rollback strategyThis is a significant database cleanup. Consider:
- Creating a rollback migration script
- Taking a database backup before applying
- Testing the migration in a staging environment first
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
backend/src/database/migrations/V1736414839__cleanupUnusedTablesAndColumns.sql
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: lint-format-services
- GitHub Check: lint-format
🔇 Additional comments (3)
backend/src/database/migrations/V1736414839__cleanupUnusedTablesAndColumns.sql (3)
12-20
: Verify backup retention requirementsThese backup tables are being dropped. Please confirm:
- The data in these backup tables is no longer needed
- This action complies with your data retention policies
- You have recent database backups before proceeding
1-10
: Verify that core feature tables are safe to dropThese tables appear to be related to core features (tasks, notes, automations). Before proceeding:
- Confirm there are no foreign key constraints that could break
- Verify that related features are completely deprecated
- Ensure no application code still references these tables
22-52
: Verify data migration for organization columnsYou're dropping 31 columns from the organizations table. While the 'old_' prefix suggests these are deprecated, please verify:
- All necessary data has been migrated to new columns
- No application code or queries still reference these columns
- Reports or analytics aren't dependent on this data
✅ Verification successful
Migration pattern verified - columns safely replaced
The migration follows a safe pattern:
- New columns were added first
- Original columns were renamed with 'old_' prefix
- Old columns are now being cleaned up
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any references to the old columns in application code echo "Checking for column references in code:" rg -i "old_(emails|phonenumbers|twitter|linkedin|crunchbase|employeecountbycountry|geolocation|ticker|profiles|address|attributes|affiliatedprofiles|allsubsidiaries|alternativedomains|alternativenames|averageemployeetenure|averagetenurebylevel|averagetenurebyrole|directsubsidiaries|employeecountbymonth|employeecountbymonthbylevel|employeecountbymonthbyrole|gicssector|grossadditionsbymonth|grossdeparturesbymonth|ultimateparent|immediateparent|weakidentities|manuallychangedfields|naics|names)"Length of output: 9354
Script:
#!/bin/bash # Check for creation of new columns in migrations between the rename and drop echo "Checking migrations for new column creation:" fd -e sql . backend/src/database/migrations/ -x cat {} \; | rg -i "add column|create type|create table|alter table \w+ add" -B1 -A1Length of output: 29771
I didn’t add undo migration. Should I add that as well? |
Changes proposed ✍️
What
copilot:summary
copilot:poem
Why
How
copilot:walkthrough
Summary by CodeRabbit