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 MariaDb database connection support #250

Merged
merged 6 commits into from
Aug 22, 2024

Conversation

SimonNyvall
Copy link
Contributor

@SimonNyvall SimonNyvall commented Aug 20, 2024

Sorry for the delay, I tried a lot of different solutions to the problem. I couldn't work out the kinks without adding the MariaDB type to the backend, so this was the best solution I could come up with. I tried to keep MariaDB only in the frontend part, but this caused some issues when copying a database, logos, etc.

I also thought it would be a good idea to sort the DataConnection in src/Apps/NetPad.Apps.Common/Data/EntityFrameworkCore/DataConnections into their own directories, but maybe in a later PR so the changes don't clutter the new MariaDB updates.

Changes made

  • TypeScript Classes and Interfaces:

    • Added MariaDbDatabaseConnection class and its corresponding interface IMariaDbDatabaseConnection to support MariaDB connections.
    • Updated the DataConnection and DatabaseConnection classes to handle MariaDB connections.
  • Data Connection View:

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

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

    • Added MariaDbDatabaseConnection class in the backend to manage MariaDb-specific database connections.
    • Implemented the MariaDbDatabaseSchemaChangeDetectionStrategy.
    • Added PomeloDatabaseConnection to handle connections for MariaDb and MySql
    • Refactored MySqlDatabaseConnection to use PomeloDatabaseConnection
  • Dependency Injection:

    • Registered MariaDbDatabaseSchemaChangeDetectionStrategy.
  • Added MariaDb icon to the resource directory.

  • Updated DataConnectionType enumeration to include MariaDb.

@tareqimbasher
Copy link
Owner

Oh no you're perfectly fine. Even though MySQL and MariaDB might share a driver, they are technically two different connection types and could end up having slightly different connection string options or configurations in the future, so keeping them separate works just fine.

This is great, thanks! I'll review and get it merged!

@tareqimbasher tareqimbasher merged commit b766b82 into tareqimbasher:main Aug 22, 2024
9 checks passed
@tareqimbasher
Copy link
Owner

@SimonNyvall I ended up completely separating the MySql and MariaDb connection types and removed the PomeloDatabaseConnection type (34cc9d7), mainly for consistency and simplicity.

I also removed the options.EnableRetryOnFailure() configurations, enabling a retry strategy will force EF to buffer all results. Adding it takes away the ability for users to stream their result sets. Users can still enable a retry policy by overriding OnConfiguringPartial on their script's DbContext. We could also add it as an option in the connection properties window.

Thanks again for the great contributions!

@SimonNyvall
Copy link
Contributor Author

@tareqimbasher thank you for merging, I will try to keep the adjustments in mind for future contributions.

It is a fun project to work on; it just takes a little while to figure out what to adjust hehe.

@tareqimbasher
Copy link
Owner

Ya I've been meaning to write some documentation on the general structure of the app and guides on how to extend certain functionality but haven't really gotten around to it yet. I'll dedicate some time to that.

@SimonNyvall
Copy link
Contributor Author

If I can be of any help @tareqimbasher , just send me a message. I can maybe point out the parts of the codebase that I still don't really get, if that would be of any help? :)

@tareqimbasher
Copy link
Owner

Yes that would be helpful actually. Go ahead and let me know what parts of the codebase you're having trouble with and I'll do my best to explain. That also might help me determine spots that need to be simplified or made more obvious :)

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