namespace SwDAL.DTO.DdlObjectHistory; // Per-object ("file") version-history row — see 056_MSWDDLOBJECTHISTORY.sql's own header for // the full git-blob-history rationale. One row per new version created for a given // {DbModelId, SchemaName, ObjectName, ObjectType}, chained via PreviousDdlScriptId. // // ObjectType (058_FIX_MSWDDLOBJECTHISTORY_ObjectType.sql) is part of the key, not just an // audit field — real, live-caught bug: two scripts legitimately sharing one OBJECTNAME (a // CREATE TABLE + a separate INSERT-only reference-data seed, e.g. MCURRENCY's own real pair) // are NOT versions of the same thing and must never share one history chain; without this, // SwPackagePromote flip-flopped both into fresh spurious versions on every re-run, forever. // Reuses SwDAL.Enums.PackageContentType's own Schema=0/MetadataOrStandardData=1 numbering — // the identical distinction, just per-script instead of per-package. public class DdlObjectHistoryDTO { public int DdlObjectHistoryId { get; set; } public int DbModelId { get; set; } public string SchemaName { get; set; } = "dbo"; public string ObjectName { get; set; } = string.Empty; public byte ObjectType { get; set; } public int DdlScriptId { get; set; } public int? PreviousDdlScriptId { get; set; } public string Checksum { get; set; } = string.Empty; public bool IsCurrentTip { get; set; } = true; // Standard M-table fields public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } } // The one thing DdlScriptBLL.Save actually needs when saving a new version — the tip it's // about to supersede, if any. Kept separate from the full DTO so the hot-path lookup only // selects the two columns it uses. public class DdlObjectCurrentTipDTO { public int DdlScriptId { get; set; } public string Checksum { get; set; } = string.Empty; }