Skip to content

Conversation

SanchithHegde
Copy link
Member

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR reorganizes the v2 related database migrations into the following 4 groups, instead of the previous migrations which were organized based on tables affected:

  1. Migrations that only add new columns: These migrations can/should be run fearlessly, since they only introduce new columns and thus should not affect the working of the v1 application.

  2. Migrations to re-create ID columns for v2: These migrations only involve dropping the SERIAL id columns from the v1 application in favor of the VARCHAR(64) id columns for the v2 application.

  3. Migrations that update database constraints: These migrations are concerned with updating the primary key constraints, and updating unique constraints and indexes as required by the v2 application.

  4. Migrations that drop columns from v1: These migrations drop columns from the v1 application that are no longer read by the v2 application. These should not be run on any of our hosted environments, until the v1 application is no longer in use.

    Running these migrations on hosted environments will cause loss of data!

In addition, this PR addresses some clippy lints thrown from v2 code.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

This PR re-organizes the existing v2 related database migrations.

Motivation and Context

This should make it easier for us to run the queries which do not affect the functioning of the v1 application and avoid running the destructive ones with higher confidence.

How did you test it?

Sanity testing with Postman.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@SanchithHegde SanchithHegde added A-framework Area: Framework S-waiting-on-review Status: This PR has been implemented and needs to be reviewed M-database-changes Metadata: This PR involves database schema changes C-refactor Category: Refactor api-v2 labels Aug 30, 2024
@SanchithHegde SanchithHegde added this to the August 2024 Release milestone Aug 30, 2024
@SanchithHegde SanchithHegde self-assigned this Aug 30, 2024
@SanchithHegde SanchithHegde requested review from a team as code owners August 30, 2024 18:07
Copy link

semanticdiff-com bot commented Aug 30, 2024

Review changes with SemanticDiff.

Analyzed 12 of 46 files.

Overall, the semantic diff is 27% smaller than the GitHub diff.

File Information
Filename Status
v2_migrations/2024-08-28-081847_drop_v1_columns/down.sql Unsupported file format
v2_migrations/2024-08-28-081847_drop_v1_columns/up.sql Unsupported file format
v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/down.sql Unsupported file format
v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/up.sql Unsupported file format
v2_migrations/2024-08-28-081747_recreate_ids_for_v2/down.sql Unsupported file format
v2_migrations/2024-08-28-081747_recreate_ids_for_v2/up.sql Unsupported file format
v2_migrations/2024-08-28-081721_add_v2_columns/down.sql Unsupported file format
v2_migrations/2024-08-28-081721_add_v2_columns/up.sql Unsupported file format
v2_migrations/2024-08-12-075913_make_profile_id_mandatory_in_mca/down.sql Unsupported file format
v2_migrations/2024-08-12-075913_make_profile_id_mandatory_in_mca/up.sql Unsupported file format
v2_migrations/2024-07-31-100300_business_profile_add_v2_columns_drop_v1_columns/down.sql Unsupported file format
v2_migrations/2024-07-31-100300_business_profile_add_v2_columns_drop_v1_columns/up.sql Unsupported file format
v2_migrations/2024-07-31-065721_mca_v2/down.sql Unsupported file format
v2_migrations/2024-07-31-065721_mca_v2/up.sql Unsupported file format
v2_migrations/2024-07-30-100323_customer_v2/down.sql Unsupported file format
v2_migrations/2024-07-30-100323_customer_v2/up.sql Unsupported file format
v2_migrations/2024-07-29-063217_drop-org_id-and-org_name-from-organization/down.sql Unsupported file format
v2_migrations/2024-07-29-063217_drop-org_id-and-org_name-from-organization/up.sql Unsupported file format
v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/down.sql Unsupported file format
v2_migrations/2024-07-26-065428_remove_deprecated_field_from_merchant_account/up.sql Unsupported file format
v2_migrations/2024-07-25-065542_drop_merchant_id_from_merchant_account/down.sql Unsupported file format
v2_migrations/2024-07-25-065542_drop_merchant_id_from_merchant_account/up.sql Unsupported file format
v2_migrations/2024-07-25-065100_change_primary_key_from_merchant_id_to_id/down.sql Unsupported file format
v2_migrations/2024-07-25-065100_change_primary_key_from_merchant_id_to_id/up.sql Unsupported file format
v2_migrations/2024-07-25-064644_add_id_in_merchant_account/down.sql Unsupported file format
v2_migrations/2024-07-25-064644_add_id_in_merchant_account/up.sql Unsupported file format
v2_migrations/2024-07-19-073520_remove_id_from_merchant_account/down.sql Unsupported file format
v2_migrations/2024-07-19-073520_remove_id_from_merchant_account/up.sql Unsupported file format
v2_migrations/2024-06-03-133421_remove_id_from_payment_table/down.sql Unsupported file format
v2_migrations/2024-06-03-133421_remove_id_from_payment_table/up.sql Unsupported file format
migrations/2024-08-29-135449_add_version_to_business_profile/down.sql Unsupported file format
migrations/2024-08-29-135449_add_version_to_business_profile/up.sql Unsupported file format
migrations/2024-08-29-135449_add_api_version_to_business_profile/down.sql Unsupported file format
migrations/2024-08-29-135449_add_api_version_to_business_profile/up.sql Unsupported file format
✔️ crates/router/src/core/admin.rs Analyzed
✔️ crates/router/src/core/payment_methods.rs 6.25% smaller
✔️ crates/router/src/core/payouts.rs 0.0% smaller
✔️ crates/router/src/core/payments/helpers.rs 88.97% smaller
✔️ crates/router/src/core/payments/tokenization.rs Analyzed
✔️ crates/router/src/core/payment_methods/cards.rs Analyzed
✔️ crates/hyperswitch_domain_models/src/business_profile.rs Analyzed
✔️ crates/diesel_models/src/business_profile.rs 49.43% smaller
✔️ crates/diesel_models/src/merchant_account.rs Analyzed
✔️ crates/diesel_models/src/merchant_connector_account.rs Analyzed
✔️ crates/diesel_models/src/schema.rs Analyzed
✔️ crates/diesel_models/src/schema_v2.rs 32.35% smaller

@SanchithHegde SanchithHegde force-pushed the reorganize-v2-migrations branch from 7b1b73e to ad1c42a Compare August 30, 2024 18:30
jarnura
jarnura previously approved these changes Aug 31, 2024
Aprabhat19
Aprabhat19 previously approved these changes Sep 2, 2024
@SanchithHegde SanchithHegde dismissed stale reviews from Aprabhat19 and jarnura via e7d4945 September 2, 2024 11:50
@likhinbopanna likhinbopanna removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Sep 2, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Sep 2, 2024
Merged via the queue into main with commit f32a329 Sep 2, 2024
14 checks passed
@likhinbopanna likhinbopanna deleted the reorganize-v2-migrations branch September 2, 2024 13:50
pixincreate added a commit that referenced this pull request Sep 3, 2024
…config-fix

* 'main' of github.com:juspay/hyperswitch:
  feat: add profile_id authentication for business profile update and list (#5673)
  chore(version): 2024.09.03.0
  feat(user): implement invitations api (#5769)
  feat(connector): [Adyenplatform] add webhooks for payout (#5749)
  refactor(v2_migrations): re-organize v2 migrations (#5760)
  chore: add wasm support for connector additional details (#5712)
  refactor(connector): Move globepay, powertranz, tsys, worldline to hyperswitch_connectors (#5758)
  fix(cypress): fix cypress throwing error when `connectorId` is not passed and miscellaneous fixes (#5746)
  chore: fix typos (#5766)
  refactor(business_profile): change id for business profile (#5748)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Area: Framework api-v2 C-refactor Category: Refactor M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants