/// <summary> /// Creates a history table link if there is a primary key on the main table. /// </summary> /// <param name="sqlTable"></param> /// <param name="schemaName"></param> /// <param name="tableName"></param> /// <returns></returns> private static string CreateHistoryTableLink(SqlTableForTemporal sqlTable, string schemaName, string tableName) { if (!sqlTable.HasPrimaryKey()) { return(string.Empty); } var historyTableName = $"{tableName}_History".BracketizeSafe(); var dbTableName = new DbTableName(schemaName, historyTableName); return($"WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = {dbTableName}))"); }
private static string GetTemporalColumns(SqlTableForTemporal sqlTable) { return(sqlTable.HasPrimaryKey() ? TemporalColumnsText : string.Empty); }