Feature: ETag-based CDN model cache invalidation
When admin replaces a model/art file via the CDN browser, the S3 ETag is now captured and stored on CardAsset.ContentETag. The ETag is included in the content sync DTO (CardAssetDto) so clients receive it on every sync. Client-side ModelCache now keys its disk cache on sha256(url + "#" + etag) instead of sha256(url), so updating a file at the same CDN path busts the disk cache automatically. A _CACHE_VER="v2" sentinel purges old-scheme .bin files on first launch after the client update. Changes: - CdnUploadResult: add string? ETag field - S3CdnClient: capture ETag from PutObjectAsync response - CardAsset: add string? ContentETag property - Migration 20260318000001_AddAssetContentETag: add content_etag text column - ContentMessages: add string? ContentETag to CardAssetDto - ContentDtoMapper: map ContentETag in CardAsset → CardAssetDto - CdnBrowser.razor: UploadFileToKeyAsync returns Task<string?> (ETag); ReplaceAsync calls PropagateAssetETagAsync which updates CardAsset rows and touches CardDefinition.UpdatedAt to trigger a version bump - ModelCache.gd: versioned disk key + cache migration + etag parameter on load_model() and evict() - game_screen.gd: pass model_asset.contentETag to load_model / retry chain Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -578,7 +578,7 @@ window.sorCdn = {
|
||||
try
|
||||
{
|
||||
var key = $"{_activePrefix}{file.Name}";
|
||||
await UploadFileToKeyAsync(key, file);
|
||||
await UploadFileToKeyAsync(key, file); // ETag not propagated for brand-new uploads (no CardAsset row yet)
|
||||
await UpsertUploadRecordAsync(key, file.ContentType, _uploadIsAiGenerated);
|
||||
_message = $"Uploaded {file.Name}.";
|
||||
_isError = false;
|
||||
@@ -606,8 +606,9 @@ window.sorCdn = {
|
||||
|
||||
try
|
||||
{
|
||||
await UploadFileToKeyAsync(_replaceTarget.Key, file);
|
||||
var etag = await UploadFileToKeyAsync(_replaceTarget.Key, file);
|
||||
await UpsertUploadRecordAsync(_replaceTarget.Key, file.ContentType, _replaceIsAiGenerated);
|
||||
await PropagateAssetETagAsync(_replaceTarget.PublicUrl, etag);
|
||||
_message = $"Replaced {_replaceTarget.Key}.";
|
||||
_isError = false;
|
||||
await LoadAsync(reset: true);
|
||||
@@ -686,7 +687,8 @@ window.sorCdn = {
|
||||
_replaceIsAiGenerated = false;
|
||||
}
|
||||
|
||||
private async Task UploadFileToKeyAsync(string key, IBrowserFile file)
|
||||
/// <summary>Upload <paramref name="file"/> to <paramref name="key"/>; returns the S3 ETag.</summary>
|
||||
private async Task<string?> UploadFileToKeyAsync(string key, IBrowserFile file)
|
||||
{
|
||||
const long maxUploadBytes = 100 * 1024 * 1024;
|
||||
|
||||
@@ -705,7 +707,36 @@ window.sorCdn = {
|
||||
DisableDefaultChecksumValidation = true,
|
||||
};
|
||||
|
||||
await S3.PutObjectAsync(request);
|
||||
var response = await S3.PutObjectAsync(request);
|
||||
return response.ETag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// After a replace, update ContentETag on any CardAsset whose CdnUrl matches
|
||||
/// <paramref name="publicUrl"/> and touch the parent CardDefinition so the
|
||||
/// definition_version trigger fires and clients pick up the change.
|
||||
/// </summary>
|
||||
private async Task PropagateAssetETagAsync(string publicUrl, string? etag)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(etag))
|
||||
return;
|
||||
|
||||
var assets = await Db.Set<SOR.Database.Entities.Catalog.CardAsset>()
|
||||
.Include(a => a.CardDefinition)
|
||||
.Where(a => a.CdnUrl == publicUrl)
|
||||
.ToListAsync();
|
||||
|
||||
if (assets.Count == 0)
|
||||
return;
|
||||
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
asset.ContentETag = etag;
|
||||
asset.CardDefinition.UpdatedAt = now;
|
||||
}
|
||||
|
||||
await Db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private async Task UpsertUploadRecordAsync(string key, string? contentType, bool isAiGenerated)
|
||||
|
||||
@@ -8,4 +8,6 @@ public sealed record CdnUploadResult(
|
||||
/// <summary>Fully-qualified public URL. Null on failure.</summary>
|
||||
string? PublicUrl,
|
||||
/// <summary>Error description. Null on success.</summary>
|
||||
string? Error);
|
||||
string? Error,
|
||||
/// <summary>ETag returned by S3 for the uploaded object. Null on failure or if S3 did not return one.</summary>
|
||||
string? ETag = null);
|
||||
|
||||
@@ -51,11 +51,11 @@ public sealed class S3CdnClient : ICdnClient
|
||||
// and CDN edges can cache aggressively without ever serving stale bytes.
|
||||
request.Headers["Cache-Control"] = "public, max-age=31536000, immutable";
|
||||
|
||||
await _s3.PutObjectAsync(request, ct);
|
||||
var response = await _s3.PutObjectAsync(request, ct);
|
||||
|
||||
var publicUrl = $"{_options.PublicBaseUrl.TrimEnd('/')}/{key}";
|
||||
_logger.LogInformation("CDN upload succeeded: {Url}", publicUrl);
|
||||
return new CdnUploadResult(true, key, publicUrl, null);
|
||||
return new CdnUploadResult(true, key, publicUrl, null, response.ETag);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -119,7 +119,9 @@ public sealed record CardAssetDto(
|
||||
bool IsAiGenerated,
|
||||
// Model3D config (asset/file-level)
|
||||
string? ModelFacingDirection,
|
||||
string? ModelTintMaskUrl);
|
||||
string? ModelTintMaskUrl,
|
||||
// Cache-busting ETag updated whenever the file is replaced via CDN browser
|
||||
string? ContentETag = null);
|
||||
|
||||
public sealed record CardAnimationBindingDto(
|
||||
Guid Id,
|
||||
|
||||
@@ -60,7 +60,8 @@ internal static class ContentDtoMapper
|
||||
a.MimeType,
|
||||
a.IsAiGenerated,
|
||||
a.ModelFacingDirection,
|
||||
a.ModelTintMaskUrl)),
|
||||
a.ModelTintMaskUrl,
|
||||
a.ContentETag)),
|
||||
AnimationBindings: c.AnimationBindings.Select(b => new CardAnimationBindingDto(
|
||||
b.Id,
|
||||
b.ActionName,
|
||||
|
||||
@@ -38,6 +38,12 @@ public sealed class CardAsset
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// S3 ETag of the uploaded object, updated whenever the file is replaced via the CDN browser.
|
||||
/// Included in the content sync DTO so clients can use it as a cache-busting key.
|
||||
/// </summary>
|
||||
public string? ContentETag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if this asset was generated by an AI tool (Midjourney, DALL-E, Stable Diffusion, etc.).
|
||||
/// Surfaced in the AI art tracker report in the admin portal.
|
||||
|
||||
+505
@@ -0,0 +1,505 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
[DbContext(typeof(CatalogDbContext))]
|
||||
[Migration("20260318000001_AddAssetContentETag")]
|
||||
partial class AddAssetContentETag
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("catalog")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AnimationCdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AnimationTrackName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CardDefinitionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CastSoundCdnUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ImpactSoundCdnUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardDefinitionId", "ActionName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("card_animation_bindings", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AssetType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CardDefinitionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ContentETag")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelFacingDirection")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelTintMaskUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardDefinitionId", "AssetType");
|
||||
|
||||
b.ToTable("card_assets", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AbilitiesJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("abilities");
|
||||
|
||||
b.Property<string>("Affinity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AttackSoundUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AttackType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("BlockedSoundUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool?>("CanAttack")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeAttacked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeBlocked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeObstructed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeSacrificed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanDefend")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanMove")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanUseAbility")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("CardType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("CollectorNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("Damage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("DamagedSoundUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DeathSoundUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("DefinitionVersion")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasDefaultValue(0L);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EffectsJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("effects");
|
||||
|
||||
b.Property<string[]>("Genus")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRetired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MaxAttackRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxChannelRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxDefense")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxHealth")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinAttackRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinChannelRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<float?>("ModelScale")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("ModelTintColor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MoveSoundUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("MovementPoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MovementType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OtherCostsJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("other_costs");
|
||||
|
||||
b.Property<Guid?>("PreviousTierId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Rarity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool?>("RequiresLos")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("RetiredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("SetId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("SpCost")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StCost")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TerramorphaMode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Tier")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Affinity");
|
||||
|
||||
b.HasIndex("CardType");
|
||||
|
||||
b.HasIndex("DefinitionVersion");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("PreviousTierId");
|
||||
|
||||
b.HasIndex("Rarity");
|
||||
|
||||
b.HasIndex("SetId");
|
||||
|
||||
b.HasIndex("IsPublished", "SetId");
|
||||
|
||||
b.ToTable("card_definitions", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateOnly?>("ReleaseDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("card_sets", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ContentType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ObjectKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UploadedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsAiGenerated");
|
||||
|
||||
b.HasIndex("ObjectKey")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Prefix");
|
||||
|
||||
b.ToTable("cdn_upload_records", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Context")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TrackCdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TrackName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Context");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.ToTable("game_audio_configs", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileBottomModel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CdnKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.ToTable("tile_bottom_models", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Affinity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelCdnKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelPublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Shape")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TexturePublicUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Affinity", "Shape")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("tile_model_bindings", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
|
||||
.WithMany("AnimationBindings")
|
||||
.HasForeignKey("CardDefinitionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CardDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
|
||||
.WithMany("Assets")
|
||||
.HasForeignKey("CardDefinitionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CardDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
|
||||
.WithMany()
|
||||
.HasForeignKey("PreviousTierId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("SetId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("PreviousTier");
|
||||
|
||||
b.Navigation("Set");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.Navigation("AnimationBindings");
|
||||
|
||||
b.Navigation("Assets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAssetContentETag : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ContentETag",
|
||||
schema: "catalog",
|
||||
table: "card_assets",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ContentETag",
|
||||
schema: "catalog",
|
||||
table: "card_assets");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,9 @@ namespace SOR.Database.Migrations.Catalog
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ContentETag")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user