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

Script for deps #188

Merged
merged 24 commits into from
Jun 14, 2024
Merged

Script for deps #188

merged 24 commits into from
Jun 14, 2024

Conversation

Hrishabh17
Copy link
Contributor

@Hrishabh17 Hrishabh17 commented Jun 10, 2024

Summary by CodeRabbit

  • Chores
    • Added a script to disable Cost Code and Cost Category, including steps to remove associated data from the database.

Hrishabh17 and others added 21 commits May 21, 2024 16:35
* Fyle Card <> Vendor Mapping setup

* Added script to add mapping_settings

* Fix post release script

* Modified script, added additional test case

* lint fix

* modify post-release script
* Fyle Card <> Vendor Mapping setup

* Added script to add mapping_settings

* Fix post release script

* Projects and Deps fields disable v1

* Modified script, added additional test case

* lint fix

* modify post-release script

* bump accounting-mapping version

* modify the variable_name, add conditional update

* Add example objects

* Added loggers

* Added test cases

* Modify test case, add filter in dep field settings
* Fyle Card <> Vendor Mapping setup

* Added script to add mapping_settings

* Fix post release script

* Projects and Deps fields disable v1

* Modified script, added additional test case

* lint fix

* modify post-release script

* bump accounting-mapping version

* modify the variable_name, add conditional update

* Add example objects

* Added loggers

* Added test cases

* Dependent Field optimizations

* fix failing test

* Fix post-release script

* Fix the merged issues
@Hrishabh17 Hrishabh17 changed the base branch from master to refactor-deps-import June 10, 2024 10:04
@Hrishabh17 Hrishabh17 requested a review from ashwin1111 June 10, 2024 10:04
Copy link

Tests Skipped Failures Errors Time
133 0 💤 0 ❌ 0 🔥 10.182s ⏱️

Copy link

coderabbitai bot commented Jun 10, 2024

Walkthrough

This update introduces a SQL script file (004_disable_deps_db_and_fyle.sql) designed to disable the use of Cost Code and Cost Category by deleting these entities and associated data from various tables. No changes to the declarations of exported or public entities are included in this update.

Changes

Files Change Summary
scripts/004_disable_deps_db_and_fyle.sql Introduces a SQL script to disable Cost Code and Cost Category, deleting related data from tables.

Poem

In the database's silent night 🌙,
Cost Codes and Categories take their flight. ✈️
Tables cleared in a sweep so grand,
Data dances in a free land. 💃
Scripts of change, a task complete,
Now, new beginnings we greet! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 110127d and 4d6094c.

Files selected for processing (1)
  • scripts/004_disable_deps_db_and_fyle.sql (1 hunks)
Files skipped from review due to trivial changes (1)
  • scripts/004_disable_deps_db_and_fyle.sql

Copy link

Tests Skipped Failures Errors Time
133 0 💤 0 ❌ 0 🔥 10.174s ⏱️

@Hrishabh17 Hrishabh17 changed the base branch from refactor-deps-import to master June 14, 2024 10:30
Copy link

Tests Skipped Failures Errors Time
133 0 💤 0 ❌ 0 🔥 10.200s ⏱️

Copy link

Tests Skipped Failures Errors Time
133 0 💤 0 ❌ 0 🔥 10.196s ⏱️

@Hrishabh17 Hrishabh17 merged commit c7faa22 into master Jun 14, 2024
1 check passed
Copy link

@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: 3

Outside diff range and nitpick comments (1)
scripts/004_disable_deps_db_and_fyle.sql (1)

1-11: Ensure all future modifications and plans are tracked in project management tools rather than in code comments for better visibility and management.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4d6094c and 476b968.

Files selected for processing (1)
  • scripts/004_disable_deps_db_and_fyle.sql (1 hunks)
Additional comments not posted (2)
scripts/004_disable_deps_db_and_fyle.sql (2)

35-37: The file paths are hardcoded which could lead to errors in different environments. Consider making these paths configurable through environment variables or configuration files.
[REFACTOR_SUGGESTion]

Also applies to: 95-97


60-74: Verify that the deletion criteria are correctly capturing all intended records and not affecting unintended ones. Testing with actual data in a controlled environment is recommended.

Also applies to: 111-115

Comment on lines +88 to +115
rollback;
begin;

create temp table temp_cost_category (
cost_category_name TEXT
);

--- update the path here
\copy temp_cost_category (cost_category_name)
from '/Users/hrishabh/Desktop/cost_category_org_name.csv' WITH CSV HEADER;

--- update the workspace id here
delete from cost_category
where name in (
select cost_category_name from temp_cost_category
)
and workspace_id = _workspace_id;

---- Fyle DB ----
--- update the org id here
rollback;
begin;

delete from platform_schema.dependent_expense_field_values
where expense_field_value in (
select cost_category_name from temp_cost_category
)
and org_id = _org_id;
Copy link

Choose a reason for hiding this comment

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

Ensure consistency in transaction management. Each operation block starts with a rollback followed by begin, which might not be necessary if the previous transactions are always meant to be rolled back. Clarify the transaction strategy with the team.


------ Cost Code ------
rollback;
begin;
Copy link

Choose a reason for hiding this comment

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

It seems there are redundant rollback statements before each begin. If this is intentional to ensure a clean state, it might be more efficient to handle this at the session or application level.

Also applies to: 58-58, 68-68, 89-89, 109-109

Comment on lines +27 to +51
------ Cost Code ------
rollback;
begin;

create temp table temp_cost_code (
cost_code_name TEXT
);

--- update the path here
\copy temp_cost_code (cost_code_name)
from '/Users/hrishabh/Desktop/cost_code_org_name.csv' WITH CSV HEADER;

--- update the workspace id here
delete from destination_attributes
where attribute_type = 'COST_CODE'
and value in (
select cost_code_name from temp_cost_code
) and workspace_id = _workspace_id;

--- update the workspace id here
delete from cost_category
where cost_code_name in (
select cost_code_name from temp_cost_code
)
and workspace_id = _workspace_id;
Copy link

Choose a reason for hiding this comment

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

Consider using parameterized queries or prepared statements to prevent SQL injection risks, especially for values derived from external sources like CSV files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants