-
Notifications
You must be signed in to change notification settings - Fork 599
MySql.AddDatabase creates database for resource #8912
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for creating MySQL databases via the AddDatabase API, including the ability to specify custom creation scripts. Key changes include:
- New functional tests demonstrating database creation with and without a custom script.
- Updates to MySqlServerResource and MySqlDatabaseResource for improved database resource management and connection string construction.
- Enhancements to MySqlBuilderExtensions for handling resource events and creating databases upon resource readiness.
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs | Added tests for AddDatabase functionality with regular and custom scripts |
src/Aspire.Hosting.MySql/MySqlServerResource.cs | Updated to track database resources with new properties |
src/Aspire.Hosting.MySql/MySqlDatabaseResource.cs | Revised connection string property using MySqlConnectionStringBuilder |
src/Aspire.Hosting.MySql/MySqlCreateDatabaseScriptAnnotation.cs | Introduced annotation class for custom database creation scripts |
src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs | Added event subscriptions and database creation logic based on resource readiness |
playground/mysql/MySqlDb.AppHost/Program.cs | Adjusted setup to include multiple databases, including one with a custom script |
playground/mysql/MySql.ApiService/Program.cs | Added keyed MySQL data source and an endpoint to query data from the custom script database |
Files not reviewed (1)
- playground/mysql/MySql.ApiService/MySql.ApiService.http: Language not supported
0556888
to
6d752bb
Compare
Note that very soon we may want to change how these scripts to use the init scripts support provided by each container instead of invoking these with ADO.NET. But it should not matter for this PR right now. |
Resolves #8294
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template