Skip to content

Commit

Permalink
Remove CosmosDB (#303)
Browse files Browse the repository at this point in the history
* Remove multiple items

- Removed AlbumReleaseDbContext.
- Removed LyricsAnalyzerDbContext.
- Removed CosmosDB to Postgres migrations.
- Removed CosmosDB as a database type.

* Remove CosmosDB to Postgres migration in main bot app

* Remove CosmosDB packages
  • Loading branch information
Smalls1652 authored Nov 15, 2024
1 parent 7fa296f commit 2eec05d
Show file tree
Hide file tree
Showing 45 changed files with 2 additions and 5,673 deletions.
2 changes: 0 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="MarkDig" Version="0.38.0" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.45.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 0 additions & 1 deletion src/App/App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<PackageReference Include="Azure.Storage.Queues" />
<PackageReference Include="Discord.Net" />
<PackageReference Include="GitVersion.MsBuild" PrivateAssets="all" />
<PackageReference Include="Microsoft.Azure.Cosmos" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
Expand Down
24 changes: 0 additions & 24 deletions src/App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using MuzakBot.Database.Extensions;
using MuzakBot.Database.Models;
using MuzakBot.Hosting.Extensions;
using MuzakBot.Lib.Services;
using MuzakBot.Lib.Services.Extensions;

DateTimeOffset startTime = DateTimeOffset.UtcNow;
Expand Down Expand Up @@ -100,23 +99,6 @@
builder.Services
.AddMuzakBotDbContextFactory(databaseConfig);

bool shouldMigrateCosmosDbToPostgres = builder.Configuration.GetValue<bool>("MIGRATE_COSMOSDB_TO_POSTGRES");
if (shouldMigrateCosmosDbToPostgres)
{
DatabaseConfig cosmosDbConfig = new()
{
DatabaseType = DatabaseType.CosmosDb,
CosmosDbConfig = new()
{
ConnectionString = builder.Configuration.GetValue<string>("COSMOSDB_CONNECTION_STRING") ?? throw new("COSMOSDB_CONNECTION_STRING is not set."),
}
};

builder.Services
.AddAlbumReleaseDbContextFactory(cosmosDbConfig)
.AddLyricsAnalyzerDbContextFactory(cosmosDbConfig);
}

builder.Services
.AddOpenAiService(options =>
{
Expand All @@ -142,10 +124,4 @@

await host.ApplyMuzakBotDbContextMigrations();

if (shouldMigrateCosmosDbToPostgres)
{
await host.MigrateCosmosDbDataToPostgresAsync();
return;
}

await host.RunAsync();
2 changes: 0 additions & 2 deletions src/Database/Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
<PackageReference Include="Azure.Core" />
<PackageReference Include="Discord.Net" PrivateAssets="all" />
<PackageReference Include="GitVersion.MsBuild" PrivateAssets="all" />
<PackageReference Include="Microsoft.Azure.Cosmos" />
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Cosmos" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2eec05d

Please sign in to comment.