Пример #1
0
    /// <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}))");
    }
Пример #2
0
 private static string GetTemporalColumns(SqlTableForTemporal sqlTable)
 {
     return(sqlTable.HasPrimaryKey()
      ? TemporalColumnsText
      : string.Empty);
 }