Skip to content

Commit

Permalink
removed unused indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
devhl-labs committed Jul 23, 2024
1 parent f986df4 commit eca3de4
Show file tree
Hide file tree
Showing 9 changed files with 446 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/scripts/cocapi-ef-migration-remove.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dotnet ef migrations remove `
--project $PSScriptRoot/../../src/CocApi.Test `
--context CocApi.Cache.CacheDbContext
--context CocApi.Cache.CacheDbContext
3 changes: 2 additions & 1 deletion docs/scripts/cocapi-ef-migration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ $count=(Get-ChildItem -File -Path $PSScriptRoot/../../src/CocApi.Test/Migrations

dotnet ef migrations add Migration$count `
--project $PSScriptRoot/../../src/CocApi.Test `
--context CocApi.Cache.CacheDbContext
--context CocApi.Cache.CacheDbContext `
--verbose
2 changes: 1 addition & 1 deletion docs/scripts/dotnet tool update --global dotnet-ef.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dotnet tool update --global dotnet-ef # --version 3.1.0
dotnet tool update --global dotnet-ef # --version 3.1.0
2 changes: 1 addition & 1 deletion docs/scripts/publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dotnet publish $PSScriptRoot/../../src/CocApi.Test/CocApi.Test.csproj `
-o $PSScriptRoot/../../src/CocApi.Test/bin/Release/net5.0/win-x64/publish `
-r win-x64 `
-p:PublishReadyToRun=true `
-p:PublishSingleFile=true
-p:PublishSingleFile=true
10 changes: 0 additions & 10 deletions src/CocApi.Cache/Context/CacheDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,25 @@ protected override void OnModelCreating(ModelBuilder builder)
builder.Entity<CachedClan>().OwnsOne(p => p.WarLog, log =>
{
log.ToTable(Library.TableNames.WarLog);
log.HasIndex(w => w.KeepUntil);
log.HasIndex(w => w.ExpiresAt);
});

// Group
builder.Entity<CachedClan>().OwnsOne(p => p.Group, group => {
group.ToTable(Library.TableNames.Group);
group.HasIndex(w => w.KeepUntil);
group.HasIndex(w => w.ExpiresAt);
});

// Player
var player = builder.Entity<CachedPlayer>().ToTable(Library.TableNames.Player);
player.HasIndex(p => p.Id).IsUnique();
player.HasIndex(p => p.KeepUntil);
player.HasIndex(p => p.ExpiresAt);
player.HasIndex(p => p.Tag).IsUnique();
player.HasIndex(p => p.ClanTag);

// War
var war = builder.Entity<CachedWar>().ToTable(Library.TableNames.War);
war.HasIndex(p => p.Id).IsUnique();
war.HasIndex(p => new { p.PreparationStartTime, p.ClanTag, p.OpponentTag }).IsUnique();
war.HasIndex(p => p.KeepUntil);
war.HasIndex(p => p.ExpiresAt);
war.HasIndex(p => p.ClanTag);
war.HasIndex(p => p.OpponentTag);
war.HasIndex(p => p.IsFinal);
war.HasIndex(p => p.WarTag);
war.HasIndex(p => p.Season);
}
}
4 changes: 2 additions & 2 deletions src/CocApi.Rest/CocApi.Rest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<Description>A wrapper for the Clash of Clans API</Description>
<Copyright>No Copyright</Copyright>
<RootNamespace>CocApi.Rest</RootNamespace>
<Version>2.11.5</Version>
<Version>2.11.6</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\CocApi.Rest.xml</DocumentationFile>
<RepositoryUrl>https://github.com/devhl-labs/CocApi.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Upgraded OpenApi with new token instantiation</PackageReleaseNotes>
<PackageReleaseNotes>Removed unused indexes</PackageReleaseNotes>
<PackageTags>ClashOfClans SuperCell devhl</PackageTags>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Loading

0 comments on commit eca3de4

Please sign in to comment.