From 51f3ee23d4cdfd894e3c7fcfb9d2dcdc6dbd308a Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 16 Mar 2026 15:05:48 -0400 Subject: [PATCH] Feature: tile height variation + stalagmite bottoms + live content refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Tile height variation (fix) Tile tops now visibly vary (0.8–1.0) from a fixed bottom at world Y=0. Previously the top was fixed and the variation was only visible underneath. Heights are seeded by tile coordinate so they're deterministic per board. Unit y_offsets and highlight positions update to match per-tile height. ## Stalagmite tile bottoms Server: new TileBottomModel entity + migration (catalog.tile_bottom_models), content.tile_bottoms handler returns all active CDN URLs. Admin: "Tile Bottom Models" section in the Tile Model Manager page — add/toggle active/delete entries with CDN picker. Client: ContentCache fetches + disk-caches the URL pool; _try_load_tile_model picks a random URL and attaches it flipped below the tile model as a stalagmite using the existing _fit_model_to_tile scale logic. ## Live content refresh ContentCache schedules start_sync() every 5 minutes after sync_complete so card definitions, tile models, and bottom models are refreshed in the background without restarting the client. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../origin-client/autoloads/ContentCache.gd | 70 ++++++- .../origin-client/scenes/game/game_screen.gd | 67 +++++-- .../Pages/Content/TileModelManagerPage.razor | 179 ++++++++++++++++++ Server/src/SOR.Content/ContentMessages.cs | 5 + .../Handlers/ContentGetTileBottomsHandler.cs | 39 ++++ Server/src/SOR.Content/ServiceRegistration.cs | 1 + .../SOR.Database/Contexts/CatalogDbContext.cs | 12 +- .../Entities/Catalog/TileBottomModel.cs | 21 ++ .../20260316200000_AddTileBottomModels.cs | 45 +++++ 9 files changed, 419 insertions(+), 20 deletions(-) create mode 100644 Server/src/SOR.Content/Handlers/ContentGetTileBottomsHandler.cs create mode 100644 Server/src/SOR.Database/Entities/Catalog/TileBottomModel.cs create mode 100644 Server/src/SOR.Database/Migrations/Catalog/20260316200000_AddTileBottomModels.cs diff --git a/Client/origin-client/autoloads/ContentCache.gd b/Client/origin-client/autoloads/ContentCache.gd index f3daf46..1d4266a 100644 --- a/Client/origin-client/autoloads/ContentCache.gd +++ b/Client/origin-client/autoloads/ContentCache.gd @@ -17,10 +17,12 @@ extends Node ## ContentCache.get_tile_model_url("Forest", "Square") → String or "" ## ContentCache.sync_complete.connect(...) -const CACHE_DIR := "user://content" -const CACHE_PATH := "user://content/defs.json" -const TILE_MODELS_PATH := "user://content/tile_models.json" -const PAGE_SIZE := 200 +const CACHE_DIR := "user://content" +const CACHE_PATH := "user://content/defs.json" +const TILE_MODELS_PATH := "user://content/tile_models.json" +const TILE_BOTTOMS_PATH := "user://content/tile_bottoms.json" +const PAGE_SIZE := 200 +const REFRESH_INTERVAL_SECS := 300.0 # re-sync every 5 minutes during live play signal sync_progress(fetched_total: int) ## Running count of total definitions in memory. signal sync_complete(total: int) ## Emitted once sync finishes. @@ -34,11 +36,15 @@ var _is_syncing: bool = false ## "Affinity_Shape" (e.g. "Forest_Square") → CDN model URL string var _tile_models: Dictionary = {} +## Array of CDN URL strings for tile bottom (stalagmite) models. +var _tile_bottom_urls: Array = [] + # ── Lifecycle ───────────────────────────────────────────────────────────────── func _ready() -> void: _load_from_disk() _load_tile_models_from_disk() + _load_tile_bottoms_from_disk() # ── Public API ──────────────────────────────────────────────────────────────── @@ -74,13 +80,14 @@ func is_syncing() -> bool: ## Start (or resume) the incremental sync. ## Emits sync_progress during, sync_complete or sync_failed when done. -## Also triggers a fresh fetch of tile model bindings. +## Also triggers a fresh fetch of tile model bindings and bottom models. func start_sync() -> void: if _is_syncing: return _is_syncing = true _fetch_page(_sync_version) fetch_tile_models() + fetch_tile_bottoms() ## Return the GLB animation track name for a card action. @@ -108,6 +115,24 @@ func get_tile_model_url(affinity: String, shape: String) -> String: return _tile_models.get(affinity + "_" + shape, "") +## Returns a random active tile bottom (stalagmite) CDN URL, or "" if none configured. +func get_random_tile_bottom_url() -> String: + if _tile_bottom_urls.is_empty(): + return "" + return _tile_bottom_urls[randi() % _tile_bottom_urls.size()] as String + + +## Fetch tile bottom model URLs from the server and update the local cache. +func fetch_tile_bottoms() -> void: + Network.request( + "content.tile_bottoms", + {}, + func(_type: String, p: Variant): _on_tile_bottoms(p), + func(code: String, msg: String): + push_warning("ContentCache: tile_bottoms fetch failed — %s %s" % [code, msg]) + ) + + ## Fetch tile model bindings from the server and update the local cache. ## Emits tile_models_ready when done (even on error, using cached data). func fetch_tile_models() -> void: @@ -151,6 +176,10 @@ func _on_page(payload: Variant) -> void: _is_syncing = false _save_to_disk() sync_complete.emit(_defs.size()) + # Schedule next background refresh so live content patches are picked up + # without restarting the client. + get_tree().create_timer(REFRESH_INTERVAL_SECS).timeout.connect( + func() -> void: start_sync(), CONNECT_ONE_SHOT) func _on_error(code: String, msg: String) -> void: @@ -174,6 +203,16 @@ func _on_tile_models(payload: Variant) -> void: _save_tile_models_to_disk() tile_models_ready.emit() + +func _on_tile_bottoms(payload: Variant) -> void: + var p := payload as Dictionary + var urls : Array = p.get("urls", []) + _tile_bottom_urls.clear() + for u in urls: + if typeof(u) == TYPE_STRING and not (u as String).is_empty(): + _tile_bottom_urls.append(u as String) + _save_tile_bottoms_to_disk() + # ── Persistence ─────────────────────────────────────────────────────────────── func _load_from_disk() -> void: @@ -225,3 +264,24 @@ func _save_tile_models_to_disk() -> void: return file.store_string(JSON.stringify(_tile_models)) file.close() + + +func _load_tile_bottoms_from_disk() -> void: + if not FileAccess.file_exists(TILE_BOTTOMS_PATH): + return + var file := FileAccess.open(TILE_BOTTOMS_PATH, FileAccess.READ) + if not file: + return + var parsed: Variant = JSON.parse_string(file.get_as_text()) + file.close() + if typeof(parsed) == TYPE_ARRAY: + _tile_bottom_urls = parsed as Array + + +func _save_tile_bottoms_to_disk() -> void: + DirAccess.make_dir_recursive_absolute(CACHE_DIR) + var file := FileAccess.open(TILE_BOTTOMS_PATH, FileAccess.WRITE) + if not file: + return + file.store_string(JSON.stringify(_tile_bottom_urls)) + file.close() diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 7bc73b0..ea2bdb0 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -160,6 +160,7 @@ var _prev_unit_hp : Dictionary = {} # instanceId → int, HP snapshot for damag var _prev_unit_pos: Dictionary = {} # instanceId → Vector2i, position snapshot for move detection var _move_anims : Dictionary = {} # instanceId → Tween (active movement tweens) var _last_attack_target_iid : String = "" # target of the most recent send_attack() call +var _tile_heights : Dictionary = {} # "x,y" → float, world Y of tile top surface # Delayed rebuild: when animations need time to play we don't destroy unit nodes immediately. var _pending_rebuild : Dictionary = {} # latest state waiting for the delayed rebuild @@ -438,6 +439,7 @@ func _build_board(board: Dictionary) -> void: _tile_bodies.clear() _unit_meshes.clear() _unit_bodies.clear() + _tile_heights.clear() for tile: Dictionary in board.get("tiles", []): var coord : Dictionary = tile.get("coord", {}) _add_tile(coord.get("x", 0), coord.get("y", 0), @@ -447,25 +449,30 @@ func _build_board(board: Dictionary) -> void: func _add_tile(x: int, y: int, affinity: String) -> void: var wp := _coord_to_world(x, y) + # Deterministic random height per tile (seeded by coord) so the same board + # always produces the same heights. Bottom is fixed at world Y=0; the TOP + # varies between 0.8 and 1.0, giving each tile a distinct elevation visible + # from the camera angle. + var rng := RandomNumberGenerator.new() + rng.seed = hash("%d_%d" % [x, y]) + var h : float = rng.randf_range(0.8, 1.0) + _tile_heights["%d,%d" % [x, y]] = h + var body := StaticBody3D.new() - body.position = wp + Vector3(0, 0.25, 0) + body.position = wp + Vector3(0, h * 0.5, 0) # centre at half-height so bottom = Y 0 body.set_meta("tile_coord", Vector2i(x, y)) + body.set_meta("tile_height", h) # used by bottom-model loader var shape := CollisionShape3D.new() var box := BoxShape3D.new() - box.size = Vector3(0.98, 0.5, 0.98) + box.size = Vector3(0.98, h, 0.98) shape.shape = box body.add_child(shape) # Placeholder: affinity-coloured flat box, swapped out if a 3D model loads. - # Visual height varies per tile (0.8–1.0) for organic terrain feel. - # The mesh is shifted downward so the TOP surface always stays at Y=0.5 in - # world space — collision shape, unit positions, and highlights are unaffected. - var vis_h : float = randf_range(0.8, 1.0) var mi := MeshInstance3D.new() var bm := BoxMesh.new() - bm.size = Vector3(0.98, vis_h, 0.98) - mi.position = Vector3(0, (0.5 - vis_h) * 0.5, 0) # shift down to keep top at body-local +0.25 + bm.size = Vector3(0.98, h, 0.98) mi.mesh = bm var mat := StandardMaterial3D.new() mat.albedo_color = AFFINITY_COLORS.get(affinity, Color(0.2, 0.2, 0.2)) @@ -481,6 +488,7 @@ func _add_tile(x: int, y: int, affinity: String) -> void: ## Load (or replace) the 3D model on a tile body for the given affinity. +## Also attaches a random stalagmite bottom model below the tile when available. ## Safe to call any time affinity changes — replaces existing mesh if present. func _try_load_tile_model(body: StaticBody3D, affinity: String) -> void: var model_url := ContentCache.get_tile_model_url(affinity, "Square") @@ -506,6 +514,33 @@ func _try_load_tile_model(body: StaticBody3D, affinity: String) -> void: b.add_child(model_node) # Scale so the XZ footprint fits the 0.98-unit tile square. _fit_model_to_tile(model_node, 0.98) + + # Attach a random stalagmite bottom model below the tile (if any are configured). + var bottom_url := ContentCache.get_random_tile_bottom_url() + if not bottom_url.is_empty(): + _try_load_tile_bottom(body_ref, bottom_url) + ) + + +## Loads a stalagmite bottom model and attaches it below the tile body. +func _try_load_tile_bottom(body_ref: Variant, url: String) -> void: + ModelCache.load_model(url, func(bottom_node: Node3D) -> void: + var b := body_ref.get_ref() as StaticBody3D + if not is_instance_valid(b): + if bottom_node != null: + bottom_node.queue_free() + return + if bottom_node == null: + return + # The body centre is at world Y = h/2. The bottom of the tile is at + # body-local Y = -h/2. Scale the stalagmite to fit the tile footprint, + # then flip it upside-down (scale Y = -1) so it hangs downward, and + # seat its origin at the tile-bottom local position. + var tile_h : float = float(b.get_meta("tile_height", 1.0)) + _fit_model_to_tile(bottom_node, 0.98) + bottom_node.scale.y = -absf(bottom_node.scale.y) # flip to hang down + bottom_node.position.y = -tile_h * 0.5 # move to tile bottom + b.add_child(bottom_node) ) @@ -614,7 +649,10 @@ func _rebuild_units(state: Dictionary) -> void: func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) -> void: var pd : Dictionary = unit.get("position", {}) if pd.is_empty(): return - var wp := _coord_to_world(pd.get("x", 0), pd.get("y", 0)) + var px : int = pd.get("x", 0) + var py : int = pd.get("y", 0) + var wp := _coord_to_world(px, py) + var tile_h : float = _tile_heights.get("%d,%d" % [px, py], 1.0) var card_type : String = unit.get("cardType", "Spirit") var iid : String = unit.get("instanceId", "") var exhausted : bool = unit.get("isExhausted", false) @@ -639,7 +677,7 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) var cs := CylinderShape3D.new() cs.radius = 0.22; cs.height = 0.8 shape.shape = cs - y_offset = 0.5 + 0.4 + y_offset = tile_h + 0.4 "Ruin": var bm := BoxMesh.new() bm.size = Vector3(0.25, 1.0, 0.25) @@ -648,7 +686,7 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) var bs := BoxShape3D.new() bs.size = Vector3(0.25, 1.0, 0.25) shape.shape = bs - y_offset = 0.5 + 0.5 + y_offset = tile_h + 0.5 _: var sm := SphereMesh.new() sm.radius = 0.28; sm.height = 0.28 @@ -657,7 +695,7 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) var ss := SphereShape3D.new() ss.radius = 0.28 shape.shape = ss - y_offset = 0.5 + 0.28 + y_offset = tile_h + 0.28 mi.material_override = mat if exhausted: @@ -1267,8 +1305,9 @@ func _add_highlight(x: int, y: int, color: Color) -> void: mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA mat.albedo_color.a = 0.75 mi.material_override = mat - # Position clearly above the tile top (tile top = Y 0.50). - mi.position = _coord_to_world(x, y) + Vector3(0, 0.58, 0) + # Position just above the tile top (varies per-tile). + var _hi_tile_h : float = _tile_heights.get("%d,%d" % [x, y], 1.0) + mi.position = _coord_to_world(x, y) + Vector3(0, _hi_tile_h + 0.08, 0) _hi_root.add_child(mi) print("[Highlight] added (%d,%d) hi_root children=%d" % [x, y, _hi_root.get_child_count()]) diff --git a/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor b/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor index 90edb1c..a5c6910 100644 --- a/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor +++ b/Server/src/SOR.Admin/Components/Pages/Content/TileModelManagerPage.razor @@ -75,6 +75,59 @@ else } } + +
+
+ Tile Bottom Models (stalagmites, randomly selected per tile) + +
+
+ @if (_bottomModels.Count == 0) + { +
No bottom models yet — upload GLBs and add them here.
+ } + else + { + + + + + + + + + + @foreach (var bottom in _bottomModels) + { + var b = bottom; + + + + + + } + +
ModelActive
+ @(b.CdnKey.Contains('/') ? b.CdnKey[(b.CdnKey.LastIndexOf('/') + 1)..] : b.CdnKey) + + + + + +
+ } +
+
+ @if (_pickerOpen) { @@ -198,6 +251,63 @@ else } + +@if (_bottomPickerOpen) +{ + +} + @code { @@ -236,6 +346,12 @@ else ("Gateways", new[] { Affinity.GatewayLake, Affinity.GatewayHill, Affinity.GatewayForest, Affinity.GatewayField }), }; + // Tile bottom models + private List _bottomModels = new(); + private bool _bottomPickerOpen; + private string _bottomPickerSearch = ""; + private string? _bottomPickerSelected; + // ── Lifecycle ───────────────────────────────────────────────────────────── protected override async Task OnInitializedAsync() => await LoadAsync(); @@ -245,6 +361,7 @@ else _loading = true; var all = await Db.TileModelBindings.ToListAsync(); _bindings = all.ToDictionary(b => (b.Affinity, b.Shape)); + _bottomModels = await Db.TileBottomModels.OrderBy(m => m.CdnKey).ToListAsync(); _loading = false; } @@ -378,6 +495,68 @@ else _isError = false; } + // ── Tile Bottom Models ──────────────────────────────────────────────────── + + private async Task OpenBottomPickerAsync() + { + _bottomPickerSelected = null; + _bottomPickerSearch = ""; + _bottomPickerOpen = true; + _pickerLoading = true; + await LoadPickerModelsAsync(); + } + + private IEnumerable BottomPickerFiltered() + { + if (string.IsNullOrWhiteSpace(_bottomPickerSearch)) + return _pickerModels; + return _pickerModels.Where(m => + m.Key.Contains(_bottomPickerSearch, StringComparison.OrdinalIgnoreCase)); + } + + private async Task SaveBottomAsync() + { + if (_bottomPickerSelected is null) return; + _saving = true; + try + { + var options = CdnOptionsAccessor.Value; + var publicUrl = BuildPublicUrl(options, _bottomPickerSelected); + var model = new TileBottomModel + { + CdnKey = _bottomPickerSelected, + PublicUrl = publicUrl, + IsActive = true, + UpdatedAt = DateTimeOffset.UtcNow, + }; + Db.TileBottomModels.Add(model); + await Db.SaveChangesAsync(); + _bottomModels.Add(model); + _bottomModels = _bottomModels.OrderBy(m => m.CdnKey).ToList(); + _bottomPickerOpen = false; + } + catch (Exception ex) + { + _message = $"Save failed: {ex.Message}"; + _isError = true; + } + finally { _saving = false; } + } + + private async Task ToggleBottomActiveAsync(TileBottomModel model, bool active) + { + model.IsActive = active; + model.UpdatedAt = DateTimeOffset.UtcNow; + await Db.SaveChangesAsync(); + } + + private async Task DeleteBottomAsync(TileBottomModel model) + { + Db.TileBottomModels.Remove(model); + await Db.SaveChangesAsync(); + _bottomModels.Remove(model); + } + // ── Helpers ─────────────────────────────────────────────────────────────── private RenderFragment ModelCell(TileModelBinding? binding, Affinity affinity, TileShape shape) => __builder => diff --git a/Server/src/SOR.Content/ContentMessages.cs b/Server/src/SOR.Content/ContentMessages.cs index 3780496..733b932 100644 --- a/Server/src/SOR.Content/ContentMessages.cs +++ b/Server/src/SOR.Content/ContentMessages.cs @@ -19,6 +19,9 @@ public sealed record GetCardDefinitionRequest(Guid Id); /// Fetch all tile model bindings (affinity × shape → CDN URL). public sealed record GetTileModelsRequest; +/// Fetch all active tile bottom (stalagmite) model URLs. +public sealed record GetTileBottomsRequest; + // ── Response / DTO types (server → client) ──────────────────────────────────── public sealed record SyncCardDefinitionsResponse( @@ -32,6 +35,8 @@ public sealed record GetCardDefinitionResponse(CardDefinitionDto? Card); public sealed record GetTileModelsResponse(IEnumerable Bindings); +public sealed record GetTileBottomsResponse(IEnumerable Urls); + public sealed record TileModelDto( string Affinity, string Shape, diff --git a/Server/src/SOR.Content/Handlers/ContentGetTileBottomsHandler.cs b/Server/src/SOR.Content/Handlers/ContentGetTileBottomsHandler.cs new file mode 100644 index 0000000..2968120 --- /dev/null +++ b/Server/src/SOR.Content/Handlers/ContentGetTileBottomsHandler.cs @@ -0,0 +1,39 @@ +namespace SOR.Content.Handlers; + +using Microsoft.EntityFrameworkCore; +using SOR.Database.Contexts; +using SOR.Networking.Abstractions.Messaging; +using SOR.Networking.Abstractions.Transport; +using SOR.Shared.Networking; + +/// +/// content.tile_bottoms — returns CDN URLs for all active tile-bottom (stalagmite) models. +/// The client randomly picks from this list when attaching an underside mesh to a tile. +/// +internal sealed class ContentGetTileBottomsHandler : IMessageHandler +{ + private readonly IMessageSerializer _serializer; + private readonly CatalogDbContext _catalogDb; + + public ContentGetTileBottomsHandler(IMessageSerializer serializer, CatalogDbContext catalogDb) + { + _serializer = serializer; + _catalogDb = catalogDb; + } + + public string MessageType => "content.tile_bottoms"; + + public async Task HandleAsync( + IClientMessage message, + AuthenticatedConnection connection, + CancellationToken ct) + { + var urls = await _catalogDb.TileBottomModels + .Where(m => m.IsActive) + .Select(m => m.PublicUrl) + .ToListAsync(ct); + + return ServerMessage.Reply("content.tile_bottoms.ack", message.Seq, + new GetTileBottomsResponse(urls)); + } +} diff --git a/Server/src/SOR.Content/ServiceRegistration.cs b/Server/src/SOR.Content/ServiceRegistration.cs index e61b0f7..267ad70 100644 --- a/Server/src/SOR.Content/ServiceRegistration.cs +++ b/Server/src/SOR.Content/ServiceRegistration.cs @@ -22,6 +22,7 @@ public static class ServiceRegistration services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); return services; diff --git a/Server/src/SOR.Database/Contexts/CatalogDbContext.cs b/Server/src/SOR.Database/Contexts/CatalogDbContext.cs index 7d0646b..1877a29 100644 --- a/Server/src/SOR.Database/Contexts/CatalogDbContext.cs +++ b/Server/src/SOR.Database/Contexts/CatalogDbContext.cs @@ -27,7 +27,8 @@ public sealed class CatalogDbContext : DbContext public DbSet AnimationBindings => Set(); public DbSet CdnUploadRecords => Set(); public DbSet TileModelBindings => Set(); - public DbSet AudioConfigs => Set(); + public DbSet TileBottomModels => Set(); + public DbSet AudioConfigs => Set(); protected override void OnModelCreating(ModelBuilder builder) { @@ -142,6 +143,15 @@ public sealed class CatalogDbContext : DbContext e.HasIndex(t => new { t.Affinity, t.Shape }).IsUnique(); }); + builder.Entity(e => + { + e.ToTable("tile_bottom_models"); + e.HasKey(t => t.Id); + e.Property(t => t.CdnKey).IsRequired(); + e.Property(t => t.PublicUrl).IsRequired(); + e.HasIndex(t => t.IsActive); + }); + builder.Entity(e => { e.ToTable("game_audio_configs"); diff --git a/Server/src/SOR.Database/Entities/Catalog/TileBottomModel.cs b/Server/src/SOR.Database/Entities/Catalog/TileBottomModel.cs new file mode 100644 index 0000000..e91a91e --- /dev/null +++ b/Server/src/SOR.Database/Entities/Catalog/TileBottomModel.cs @@ -0,0 +1,21 @@ +namespace SOR.Database.Entities.Catalog; + +/// +/// A stalagmite / underside 3D model that the client attaches below tile models. +/// The client randomly picks from all active records each time a tile loads. +/// +public sealed class TileBottomModel +{ + public Guid Id { get; set; } = Guid.NewGuid(); + + /// S3 object key, e.g. "models/tiles/bottoms/stalactite_01.glb". + public string CdnKey { get; set; } = string.Empty; + + /// Publicly accessible CDN URL for the model file. + public string PublicUrl { get; set; } = string.Empty; + + /// When false the model is excluded from the pool returned to clients. + public bool IsActive { get; set; } = true; + + public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow; +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260316200000_AddTileBottomModels.cs b/Server/src/SOR.Database/Migrations/Catalog/20260316200000_AddTileBottomModels.cs new file mode 100644 index 0000000..43e6369 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260316200000_AddTileBottomModels.cs @@ -0,0 +1,45 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SOR.Database.Migrations.Catalog +{ + /// + public partial class AddTileBottomModels : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "tile_bottom_models", + schema: "catalog", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CdnKey = table.Column(type: "text", nullable: false), + PublicUrl = table.Column(type: "text", nullable: false), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), + }, + constraints: table => + { + table.PrimaryKey("PK_tile_bottom_models", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_tile_bottom_models_IsActive", + schema: "catalog", + table: "tile_bottom_models", + column: "IsActive"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "tile_bottom_models", + schema: "catalog"); + } + } +}