-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: raise notice to delete dependent fields after workspace reset #583
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -327,6 +327,17 @@ BEGIN | |
RAISE NOTICE E'\n\n\n\n\n\n\n\n\nSwitch to prod db and run the below query to update the subscription'; | ||
RAISE NOTICE E'begin; update platform_schema.admin_subscriptions set is_enabled = false where org_id = ''%'';\n\n\n\n\n\n\n\n\n\n\n', _org_id; | ||
|
||
RAISE NOTICE E'\n\n\n\n\n\n\n\n\nSwitch to prod db and run the below queries to delete dependent fields | ||
|
||
|
||
rollback; | ||
begin; | ||
|
||
delete from platform_schema.dependent_expense_field_mappings where expense_field_id in (select id from platform_schema.expense_fields where org_id =''%'' and type=''DEPENDENT_SELECT''); | ||
|
||
delete from platform_schema.expense_fields where org_id = ''%'' and type = ''DEPENDENT_SELECT'';\n\n\n\n\n\n\n\n\n\n\n', _org_id, _org_id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification The deletion order is correct, but additional cleanup may be needed The verification reveals:
Suggested cleanup order:
🔗 Analysis chainVerify the impact of deleting dependent fields The new cleanup steps for dependent fields should be verified to ensure:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for potential foreign key dependencies on dependent fields
# Search for foreign key references to dependent_expense_field_mappings
rg -i "foreign\s+key.*dependent_expense_field_mappings"
# Search for foreign key references to expense_fields
rg -i "foreign\s+key.*expense_fields"
# Search for any other references to these tables that might indicate dependencies
rg -i "dependent_expense_field_mappings|expense_fields.*type\s*=\s*'DEPENDENT_SELECT'"
Length of output: 653 Script: #!/bin/bash
# Let's check for any references to mapping_settings table and its relationship with expense_fields
rg -i "mapping_settings.*expense_field" -A 3 -B 3
# Also check if there are any other tables referencing expense_fields
ast-grep --pattern 'CREATE TABLE $_ (
$$$
FOREIGN KEY ($$$) REFERENCES expense_fields($$$)
$$$
)'
# Check if mapping_settings table has any relation to DEPENDENT_SELECT type fields
rg -i "mapping_settings.*type.*DEPENDENT_SELECT" -A 3 -B 3
Length of output: 2782 |
||
|
||
|
||
RETURN; | ||
END | ||
$$ LANGUAGE plpgsql; |
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.
🛠️ Refactor suggestion
Remove unnecessary transaction block
The
rollback
andbegin
statements in the notice are unnecessary since these are just example queries to be run later. They should be removed to avoid confusion.