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

Add MySQL Database Connection Support #247

Merged
merged 9 commits into from
Aug 18, 2024

Conversation

SimonNyvall
Copy link
Contributor

Added support for MySQL connections; thought it could be fun. Tested manually before merging, but I might have missed something. If so, just let me know.

Changes Made

  • TypeScript Classes and Interfaces:

    • Added MySqlDatabaseConnection class and its corresponding interface IMySqlDatabaseConnection to support MySQL connections.

    • Updated the DataConnection and DatabaseConnection classes to handle MySQL connections.

  • Data Connection View:

    • Created MysqlView class to manage MySQL connections, host, port, authentication, and database configurations.
  • Window Updates:

    • Updated the Connection Window to include an option for MySQL connections in the connection type selection.
  • Backend Integration:

    • Added MySqlDatabaseConnection class in the backend to manage MySQL-specific database connections.
    • Implemented the MySqlDatabaseSchemaChangeDetectionStrategy.
  • Dependency Injection:

    • Registered MySqlDatabaseSchemaChangeDetectionStrategy.
  • Added MySQL icon to the resource directory.

  • Updated GlobalConsts to support the .NET versioning for the MySQL provider.

  • Updated DataConnectionType enumeration to include MySQL.

  • Tests:

    • Created unit tests for MySqlDatabaseConnection to validate the connection string formatting.

@tareqimbasher
Copy link
Owner

This is great! I'll review this and let you know.

@SimonNyvall
Copy link
Contributor Author

Happy to help! Just want to say that I started with the official MySql.EntityFrameworkCore package, but ran into problems within the EntityFrameworkRelationalDatabaseConnection something wrong with the package where it casts longs to ints. So I switched to Pomelo.EntityFrameworkCore.MySql. Still supported nevertheless.

@SimonNyvall
Copy link
Contributor Author

SimonNyvall commented Aug 16, 2024

Turns out the Pomelo.EntityFrameworkCore.MySql package is compatible with MariaDB as well. I made a demo branch to test it out. Just needed to add some frontend code, and that was it. I bet we can do the same with Azure Database using MS SQL Server.

So maybe Pemelo is the way to go?

@tareqimbasher
Copy link
Owner

@SimonNyvall I totally agree, Pomelo is the way to go. Supporting MariaDB as well is an awesome bonus. I'll be reviewing this PR in the next few hours and I'll send you any feedback. Thank you for all the hard work here!

I've never messed with Azure SQL DB but if we can add support for it as well using the same MS SQL Server driver that would be wonderful. I wonder if #66 will be a part of implementing that.

@tareqimbasher tareqimbasher requested review from tareqimbasher and removed request for tareqimbasher August 18, 2024 21:22
@tareqimbasher
Copy link
Owner

Looks good! It's ready to merge. I looked at the demo branch for MariaDB looks like you got a handle on things there too. I'll merge this PR and you can submit the MariaDB changes when you're ready.

I found a nuget package reference conflict but that is an issue that isn't directly related to the changes you made, your changes surfaced the issue though. I'll solve it after merging this.

@tareqimbasher tareqimbasher merged commit 679f61c into tareqimbasher:main Aug 18, 2024
9 checks passed
@SimonNyvall
Copy link
Contributor Author

No worries, I thought it was fun. Like I said, happy to help!

I have been taking a deeper look into the mariaDb support without adding duplicate code to the backend and there seems to be a few issues with that strategy (works but not the finesses). Have a free day tomorrow, so I will se what I can do.

Checked out issue #66 and I can try to replicate the problem and a fix after I have finished the maria support. I guess those are similar, and that we need to implement a separate instance of mariaDb and Azure SQL that is separate from mySQL and SQL Server.

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