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

Making Hyperswitch Server support for mysql with diesel library #4278

Open
2 tasks done
thegeek13242 opened this issue Apr 2, 2024 · 0 comments
Open
2 tasks done
Labels
C-feature Category: Feature request or enhancement S-awaiting-triage Status: New issues that have not been assessed yet

Comments

@thegeek13242
Copy link

Feature Description

Objective

The primary objective of this proposal is to provide a detailed plan for integrating MySQL support into our existing Diesel-based application.
This issue is for submitting a proposal for the discussion #4179

Possible Implementation

Steps for Integration

  • Add MySQL Dependencies in Cargo.toml
  • Setup Database Connection: Set up a MySQL database and add the database URL to a .env file.
  • Establish Connection: Use Diesel’s MysqlConnection to establish a connection to the database:
use diesel::r2d2::{ConnectionManager, Pool};

type MysqlPool = Pool<ConnectionManager<MysqlConnection>>;

pub fn establish_connection(database_url: &str) -> MysqlPool {
    let manager = ConnectionManager::<MysqlConnection>::new(database_url);
    Pool::builder().build(manager).expect("Failed to create pool.")
}
  • Clone the database models in MySQL similar to those of PSQL using Diesel Macros
  • Diesel provides a feature called diesel_migrations which allows we can handle database schema changes.
  • Perform CRUD Operations: With the established connection, we can now perform CRUD operations.

Have you spent some time checking if this feature request has been raised before?

  • I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

Yes, I am willing to submit a PR!

@thegeek13242 thegeek13242 added C-feature Category: Feature request or enhancement S-awaiting-triage Status: New issues that have not been assessed yet labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: Feature request or enhancement S-awaiting-triage Status: New issues that have not been assessed yet
Projects
None yet
Development

No branches or pull requests

1 participant