Making Hyperswitch Server support for mysql with diesel library #4179
Replies: 17 comments 9 replies
-
good-first-issue! |
Beta Was this translation helpful? Give feedback.
-
In line with our vision to make Hyperswitch pluggable with any database technology, we're considering adding MySQL support alongside the existing PostgreSQL (PSQL) support. This proposal outlines the steps to implement MySQL compatibility in Hyperswitch using the Diesel ORM library. Steps to Implement: Setup Hyperswitch locally: Configure Diesel with MySQL: Database Schema Compatibility: Test Compatibility: Performance Optimization : Documentation and Deployment: Expected Outcome: Additional Notes: |
Beta Was this translation helpful? Give feedback.
-
Proposal for Adding MySQL Support to HyperswitchObjective: Extend Hyperswitch compatibility to include MySQL databases alongside existing support for PostgreSQL. Steps: 1) Configuring Diesel for MySQL:
2) Database Schema and Migrations:
3) SQL Query Adjustments:
4) ORM Mapping Adjustments:
5) Testing:
6) Performance Tuning:
7) Documentation Update:
8) Release and Feedback:
Conclusion: By implementing MySQL support in Hyperswitch, we aim to enhance the flexibility and usability of the system, allowing users to leverage the benefits of MySQL's widespread adoption in addition to PostgreSQL. This proposal outlines a structured approach to achieve this objective while ensuring the integrity and reliability of the Hyperswitch platform. |
Beta Was this translation helpful? Give feedback.
-
Hyperswitch Server support for MySQL with diesel libraryHere is my approach and working approach
About Me |
Beta Was this translation helpful? Give feedback.
-
@manojradhakrishnan @SanchithHegde How can we get ahead to start this work? Can clarify what the hiring hiring-challenge label is? What could be my next steps? |
Beta Was this translation helpful? Give feedback.
-
Proposal for Adding MySQL Support to Hyperswitch Steps:
Below is a high-level overview of the code changes required:
These proposed changes aim to make the database.rs file compatible with both PostgreSQL and MySQL databases. By using conditional compilation based on feature flags, the codebase can seamlessly switch between the two database systems, allowing Hyperswitch to support MySQL alongside its existing PostgreSQL support. |
Beta Was this translation helpful? Give feedback.
-
Do we provide our plan to complete the task before getting started on it? |
Beta Was this translation helpful? Give feedback.
-
Proposal up at #4191 |
Beta Was this translation helpful? Give feedback.
-
Proposal for Adding MySQL Support to Hyperswitch Objective: Steps:
Code Changes Overview:
Hyperswitch will seamlessly integrate MySQL support alongside its existing PostgreSQL compatibility. This expansion will enhance the application's versatility and appeal to a broader audience, aligning with the project's goals of providing a flexible and robust database solution. |
Beta Was this translation helpful? Give feedback.
-
Challenge Proposal: Hyperswitch Server support for MySQL with Diesel LibraryProblem:While Diesel supports PostgreSQL, MySQL, and SQLite, Hyperswitch currently only supports PostgreSQL. The challenge lies in extending this support to MySQL. Expected Outcome:The strategy for implementing MySQL support in Hyperswitch cleanly. Proposal:To address the challenge of extending Hyperswitch's database support to MySQL, the following steps can be undertaken:
This proposal aims to provide a structured approach towards achieving MySQL compatibility in Hyperswitch. |
Beta Was this translation helpful? Give feedback.
-
Proposal: Hyperswitch Server support for MySQL with Diesel LibrarySteps to Implement:Setup Hyperswitch locally: Follow the instructions in the provided documentation to set up Hyperswitch locally and ensure it is running with PostgreSQL as the database. Configure Diesel with MySQL: Database Schema Compatibility: Test Compatibility: Performance Optimization: Documentation and Deployment: Expected Outcome: Conclusion: Successful implementation of this proposal will result in Hyperswitch being a more versatile and flexible application, capable of operating with either PostgreSQL or MySQL as the underlying database management system. This increased compatibility will allow Hyperswitch to be adopted in a wider range of environments and infrastructures, catering to the preferences and existing setups of different organizations and teams. Moreover, the performance optimizations carried out during the implementation process will ensure that Hyperswitch maintains its efficiency and reliability when running with MySQL, providing a seamless experience for users and developers alike. |
Beta Was this translation helpful? Give feedback.
-
Context To keep things simpler, we initially chose PSQL for building Hyperswitch. However the vision was to keep Hyperswitch pluggable with any database technology. Since we adopted Rust as the programming language, we chose diesel as our database communication library, due to its ORM nature. Problem With MySQL having greater than 40%+ market share in the Relational Database market, we would prefer to have Hyperswitch compatible with MySQL. Diesel supports communication with PSQL, MySQL and SQLite - Hyperswitch is currently built to support only PSQL. The challenge is to extend the support to MySQL. Expected Outcome Share a proposal on how you can help us implement this in a clean manner. Create the proposal as Github issue and share under this discussion. Proposal for Adding MySQL Support to Hyperswitch Objective: The objective of this proposal is to extend the database support of Hyperswitch to include MySQL, in addition to the existing PostgreSQL support. Approach: To achieve this objective, we propose the following steps: Research and Analysis: Investigate the differences between PostgreSQL and MySQL in terms of SQL syntax, data types, and features supported by both databases.Understand the compatibility challenges and potential solutions for adapting Hyperswitch's database operations to work seamlessly with MySQL. Database Abstraction Layer: Implement a database abstraction layer within Hyperswitch to encapsulate the specific database operations.Design the abstraction layer to provide a unified interface for interacting with different database systems, allowing seamless switching between PostgreSQL and MySQL. Adaptation of Diesel ORM: Leverage the capabilities of the Diesel ORM library to facilitate database communication.Modify the existing database interaction code to be compatible with both PostgreSQL and MySQL, utilizing Diesel's features for generating SQL queries and managing database connections. Configuration and Integration: Introduce configuration options for specifying the target database type (PostgreSQL or MySQL) in Hyperswitch's configuration files.Implement mechanisms for dynamically configuring database connections based on the chosen database type. Testing and Validation: Develop comprehensive test suites to validate the functionality of Hyperswitch with both PostgreSQL and MySQL databases.Conduct thorough testing to ensure that all database operations, including CRUD operations and transactions, behave as expected across different database platforms. |
Beta Was this translation helpful? Give feedback.
-
Proposal: Adding MySQL Support to Hyperswitch #4179Overview: This proposal seeks to enhance Hyperswitch by integrating MySQL support alongside its existing PostgreSQL compatibility. The plan involves modifying database configurations, creating migration scripts for seamless transitions, adjusting the codebase for MySQL compatibility, conducting comprehensive testing, changing the configuration to target MySQL, implementing CRUD APIs for Merchant Account functionality using MySQL connections, and ensuring thorough documentation and test coverage. By following these steps, Hyperswitch will significantly improve its compatibility and flexibility in database selection, offering users a broader range of options while maintaining robust functionality and performance. Steps: Database Configuration:
Migration Scripts: Create migration scripts to ensure a seamless transition for existing PostgreSQL users to MySQL. Adjust data types, constraints, and queries to MySQL-compatible syntax.
Codebase Modification: Identify PostgreSQL-specific syntax and functions used in the codebase and replace them with MySQL equivalents or adjust them to be database-agnostic. Ensure compatibility with MySQL-specific features and limitations.
Testing: Develop comprehensive test cases to validate the functionality and performance of Hyperswitch with MySQL. Test various scenarios, including CRUD operations, transactions, concurrent access, and error handling. Change Configuration to MySQL: Update the configuration settings in Hyperswitch to target MySQL instead of PostgreSQL. This involves modifying the database configuration file (e.g., database.rs or config.rs) to use MySQL connection parameters. We can modify the database configuration to target MySQL:
Ensure that the MYSQL_DATABASE_URL environment variable is set to the MySQL database URL in your development environment or configuration files. Implement CRUD APIs for Merchant Account using MySQL:Now that the configuration is updated to use MySQL, we can proceed to implement CRUD APIs for the Merchant Account functionality using MySQL connections. We can implement CRUD operations for the Merchant Account in a file like merchant_account.rs:
Replace merchant_accounts with the actual table name for Merchant Accounts in our database schema. Testing: After implementing the CRUD APIs for the Merchant Account with MySQL connections, it's crucial to thoroughly test the functionality. Write unit tests and integration tests to cover CRUD operations, error handling, and edge cases. We can write a unit test for creating a Merchant Account using MySQL:
Ensure that we have a separate test database and environment variables (MYSQL_TEST_DATABASE_URL) set for testing purposes. Once the implementation and testing of CRUD APIs for the Merchant Account using MySQL are completed, and the main Hyperswitch codebase. Include documentation, test cases. By following these steps, we can successfully change the configuration to MySQL and implement CRUD APIs for the Merchant Account functionality in Hyperswitch. |
Beta Was this translation helpful? Give feedback.
-
Proposal for Implementing MySQL Support in Hyperswitch #4179 @manojradhakrishnanIntroduction: This proposal outlines a detailed approach to incorporate MySQL support into Hyperswitch, leveraging Docker Compose for containerized development and Diesel for database interaction. Benefits:
Implementation Plan: Step 1: Edit Docker Compose by adding MySql: mysql:
image: mysql:5.7
networks:
- router_net
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: hyperswitch_db
MYSQL_USER: db_user
MYSQL_PASSWORD: db_pass
# Migrations
sql_migration_runner:
image: rust:latest
command: "bash -c 'cargo install diesel_cli --no-default-features --features mysql && diesel migration --database-url mysql://$${DATABASE_USER}:$${DATABASE_PASSWORD}@$${DATABASE_HOST}:$${DATABASE_PORT}/$${DATABASE_NAME} run'"
working_dir: /app
networks:
- router_net
volumes:
- ./:/app
environment:
- DATABASE_USER=db_user
- DATABASE_PASSWORD=db_pass
- DATABASE_HOST=mysql
- DATABASE_PORT=3306
- DATABASE_NAME=hyperswitch_db **Step 2: Diesel Features in Model Crate **
**Step 3: Database Connection Function **
Step 4: Error Handling Function:
Step 5: Model and Schema Updates (Code Focus):
|
Beta Was this translation helpful? Give feedback.
-
Proposal: Adding MySQL Support to Hyperswitch Using Diesel #4179 Objective: Scope of Work: Configuration Changes: Update the Cargo.toml file to include the MySQL driver dependency for Diesel. Review and modify SQL queries generated by Diesel to ensure compatibility with MySQL syntax and semantics. Identify and address data type differences between PostgreSQL and MySQL (e.g., handling JSONB data type in PostgreSQL vs. JSON data type in MySQL). Review existing ORM mappings and relationships in Hyperswitch's codebase. Test transaction handling and concurrency control mechanisms in a MySQL environment. Evaluate performance differences between PostgreSQL and MySQL. Dependency Management: Add the MySQL driver dependency (e.g., diesel_mysql) to the Cargo.toml file. Review all SQL queries generated by Diesel's query builder and modify them for MySQL compatibility. Implement data type conversions or mappings in Diesel's schema definitions for MySQL-specific data types. Review and update ORM mappings, associations, and constraints to align with MySQL's database schema conventions. Develop unit tests and integration tests specifically for MySQL compatibility. |
Beta Was this translation helpful? Give feedback.
-
Added my proposal @ Issues #4278 @manojradhakrishnan |
Beta Was this translation helpful? Give feedback.
-
Sure
…On Tue, Jul 16, 2024, 10:47 AM Neeraj ***@***.***> wrote:
Closed #4179 <#4179> as
resolved.
—
Reply to this email directly, view it on GitHub
<#4179>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBIONPCC2GBB6TQ7YQ4IC43ZMSUHHAVCNFSM6AAAAABFDH4YC6VHI2DSMVQWIX3LMV45UABFIRUXGY3VONZWS33OIV3GK3TUHI5E433UNFTGSY3BORUW63R3GEZTSNRYGU4A>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Context
To keep things simpler, we initially chose PSQL for building Hyperswitch. However the vision was to keep Hyperswitch pluggable with any database technology.
Since we adopted Rust as the programming language, we chose diesel as our database communication library, due to its ORM nature.
Problem
With MySQL having greater than 40%+ market share in the Relational Database market, we would prefer to have Hyperswitch compatible with MySQL.
Diesel supports communication with PSQL, MySQL and SQLite - Hyperswitch is currently built to support only PSQL. The challenge is to extend the support to MySQL.
How to get started?
Expected Outcome
Share a proposal on how you can help us implement this in a clean manner. Create the proposal as Github issue and share under this discussion.
Beta Was this translation helpful? Give feedback.
All reactions