/// <summary> /// Creates the <paramref name="tableTemplate"/> in the database location <paramref name="expectedTable"/>. /// </summary> /// <param name="expectedTable"></param> /// <param name="tableTemplate"></param> public void CreateTable(DiscoveredTable expectedTable, ImageTableTemplate tableTemplate) { expectedTable.Database.CreateTable(expectedTable.GetRuntimeName(), tableTemplate.GetColumns(expectedTable.Database.Server.DatabaseType)); if (!expectedTable.Exists()) { throw new Exception("Table did not exist after issuing create statement!"); } }
/// <summary> /// Returns the table creation script to create a new table of the given <paramref name="tablename"/> in the supplied <paramref name="expectedDatabase"/> /// that matches the <paramref name="tableTemplate"/> /// </summary> /// <param name="expectedDatabase"></param> /// <param name="tablename"></param> /// <param name="tableTemplate"></param> /// <param name="schema">Only applies to DBMS which support schemas (e.g. dbo)</param> /// <returns></returns> public string GetCreateTableSql(DiscoveredDatabase expectedDatabase, string tablename, ImageTableTemplate tableTemplate, string schema = null) { return(expectedDatabase.Helper.GetCreateTableSql(expectedDatabase, tablename, tableTemplate.GetColumns(expectedDatabase.Server.DatabaseType), null, false, schema)); }