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

Mysql storage #777

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Mysql storage #777

wants to merge 6 commits into from

Conversation

Shamus03
Copy link

Add a new storage type option that stores package contents in MySql
along with the package metadata.

Though MySql is not the best for storing large file contents, this is an
alternative to storing package contents in the file system, which should be
better for highly-available/distributed use cases.

Add a new storage type option that stores package contents in MySql
along with the package metadata. Though MySql is not the best for
storing large file contents, this is an alternative to storing package
contents in the file system, which should be better for
highly-available/distributed use cases.
@Shamus03
Copy link
Author

More information about our use case. We run BaGet in multiple datacenters pointing to a MySql database. Since BaGet only supports saving package contents to the file system, we use a distributed file system to store those documents. However, distributed file systems are not perfect and sparing you the details, we think it would be better for us to store the package contents in our MySql database along with the package metadata so everything is in one place. I think this will not be an uncommon thought.

@@ -133,6 +134,11 @@ private static void AddDefaultProviders(this IServiceCollection services)
return provider.GetRequiredService<FileStorageService>();
}

if (configuration.HasStorageType("mysql"))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized this should perhaps be "database" not "mysql". What do you think @loic-sharma?

Comment on lines +11 to +19
migrationBuilder.AlterColumn<DateTime>(
name: "RowVersion",
table: "Packages",
rowVersion: true,
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp(6)",
oldNullable: true)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was tempted to remove this but I see it is in every other migration file. Do you have a preference?

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.

1 participant