public override void BuildColumnModifySql(DbObjectChange change, DbColumnInfo column, DbScriptOptions options = DbScriptOptions.None) { var colSpec = GetColumnSpec(column, options); var tbl = column.Table; var scriptType = options.IsSet(DbScriptOptions.CompleteColumnSetup) ? DbScriptType.ColumnSetupComplete : DbScriptType.ColumnModify; change.AddScript(scriptType, "ALTER TABLE {0} MODIFY COLUMN {1};", tbl.FullName, colSpec); }
public override void BuildTableAddSql(DbObjectChange change, DbTableInfo table) { const string SqlTemplate = @"CREATE TABLE {0} (" + "\r\n {1} \r\n); "; var specs = table.Columns.Select(c => GetColumnSpec(c)).ToList(); //Until now it was the same as default impl method in base class. Now we need to add Primary key and Foreign key constraints //Primary Key var pk = table.PrimaryKey; var col0 = pk.KeyColumns[0].Column; //Identity Primary Key is taken care of in GetColumnSpec // Note: looks like we need to declare identity PK in GetColumnSpec - SQLite is quite tricky in this way if (!col0.Flags.IsSet(DbColumnFlags.Identity)) { var strKeyCols = pk.KeyColumns.GetSqlNameList(); var pkSpec = string.Format("PRIMARY KEY({0})", strKeyCols); specs.Add(pkSpec); } //Foreign keys (ref constraints foreach(var refC in table.RefConstraints) { var strKeyCols = refC.FromKey.KeyColumns.GetSqlNameList(); //find target table var strPkKeyCols = refC.ToKey.KeyColumns.GetSqlNameList(); var fkSpec = string.Format("FOREIGN KEY({0}) REFERENCES {1}({2})", strKeyCols, refC.ToKey.Table.TableName, strPkKeyCols); if(refC.CascadeDelete) fkSpec += " ON DELETE CASCADE"; specs.Add(fkSpec); } //Build final Table statement var columnSpecs = string.Join("," + Environment.NewLine, specs); change.AddScript(DbScriptType.TableAdd, SqlTemplate, table.FullName, columnSpecs); }
internal DbObjectChange AddChange(DbModelObjectBase oldObj, DbModelObjectBase newObj, DbObjectChangeType?changeType = null, string notes = null) { var change = new DbObjectChange(oldObj, newObj, changeType, notes); this.Changes.Add(change); return(change); }
public DbObjectChange AddChange(DbModelObjectBase oldObject, DbModelObjectBase newObject, string notes = null) { var change = new DbObjectChange(oldObject, newObject, null, notes); NonTableChanges.Add(change); return(change); }
public DbUpgradeScript(DbScriptType scriptType, string sql, DbObjectChange modelChange = null, ApplyPhase phase = ApplyPhase.Default) { ScriptType = scriptType; Sql = sql; ModelChange = modelChange; Phase = phase; _creationOrder = System.Threading.Interlocked.Increment(ref _creationCount); }
private int _creationOrder; //used for keeping 'natural' (creation order) to later use it when applying scripts #endregion Fields #region Constructors public DbUpgradeScript(DbScriptType scriptType, string sql, DbObjectChange modelChange = null, ApplyPhase phase = ApplyPhase.Default) { ScriptType = scriptType; Sql = sql; ModelChange = modelChange; Phase = phase; _creationOrder = System.Threading.Interlocked.Increment(ref _creationCount); }
//ALTER TABLE employees DROP COLUMN "employee_num"; public override void BuildColumnDropSql(DbObjectChange change, DbColumnInfo column) { if(!string.IsNullOrEmpty(column.DefaultExpression)) change.AddScript(DbScriptType.ColumnModify, "ALTER TABLE {0} DROP CONSTRAINT \"{1}\";", column.Table.FullName, column.DefaultConstraintName); //Note: the column drop comes after table-rename, so it might be table is already renamed, and we have to get its new name var tableName = column.Table.Peer.FullName; //new name if renamed change.AddScript(DbScriptType.ColumnDrop, "ALTER TABLE {0} DROP COLUMN \"{1}\";", tableName, column.ColumnName); }
//not supported; all we can do is nullify it; so if it is a FK it no longer holds target refs public override void BuildColumnDropSql(DbObjectChange change, DbColumnInfo column) { //Note: the column drop comes after table-rename, so it might be table is already renamed, and we have to get its new name var tableName = column.Table.Peer.FullName; //new name if renamed if (column.Flags.IsSet(DbColumnFlags.Nullable) && column.Flags.IsSet(DbColumnFlags.ForeignKey)) { change.AddScript(DbScriptType.ColumnInit, "UPDATE {0} SET \"{1}\" = NULL;", tableName, column.ColumnName); } }
public override void BuildStoredProcDropSql(DbObjectChange change, DbCommandInfo command) { if(command.CustomTag == null) { //try to recover it var inpParams = command.Parameters.Where(p => p.Direction != ParameterDirection.Output); command.CustomTag = string.Join(", ", inpParams.Select(p => p.TypeInfo.SqlTypeSpec)); } var funcRef = string.Format(@"{0}.""{1}""({2})", command.Schema, command.CommandName, command.CustomTag); change.AddScript(DbScriptType.RoutineDrop, "DROP FUNCTION {0};", funcRef); }
public override void BuildCustomTypeAddSql(DbObjectChange change, DbCustomTypeInfo typeInfo) { var sqlCreateTemplate = "CREATE TYPE {0} AS TABLE ([Value] Sql_Variant);"; var sqlGrantTemplate = "Grant EXECUTE on TYPE::{0} to {1};"; change.AddScript(DbScriptType.CustomTypeAdd, sqlCreateTemplate, typeInfo.FullName); if (!string.IsNullOrWhiteSpace(Settings.GrantExecReadToRole)) change.AddScript(DbScriptType.CustomTypeAdd, sqlGrantTemplate, typeInfo.FullName, Settings.GrantExecReadToRole); if (!string.IsNullOrWhiteSpace(Settings.GrantExecWriteToRole) && Settings.GrantExecWriteToRole != Settings.GrantExecReadToRole) change.AddScript(DbScriptType.CustomTypeAdd, sqlGrantTemplate, typeInfo.FullName, Settings.GrantExecWriteToRole); }
//ALTER TABLE employees ALTER COLUMN [employee_name] nvarchar(100) Null; public virtual void BuildColumnModifySql(DbObjectChange change, DbColumnInfo column, DbScriptOptions options = DbScriptOptions.None) { var scriptType = options.IsSet(DbScriptOptions.CompleteColumnSetup) ? DbScriptType.ColumnSetupComplete : DbScriptType.ColumnModify; if(ShouldResetNullsToDefault(column)) { BuildColumnSetDefaultValuesSql(change, column); scriptType = DbScriptType.ColumnSetupComplete; } var colSpec = GetColumnSpec(column); change.AddScript(scriptType, "ALTER TABLE {0} ALTER COLUMN {1};", column.Table.FullName, colSpec); }
public override void BuildColumnModifySql(DbObjectChange change, DbColumnInfo column, DbScriptOptions options = DbScriptOptions.None) { if(ShouldResetNullsToDefault(column)) BuildColumnSetDefaultValuesSql(change, column); // In Pg you modify column one aspect at a time; setting TYPE and Nullable requires 2 calls change.AddScript(DbScriptType.ColumnModify, "ALTER TABLE {0} ALTER COLUMN \"{1}\" TYPE {2};", column.Table.FullName, column.ColumnName, column.TypeInfo.SqlTypeSpec); var nullStr = column.Flags.IsSet(DbColumnFlags.Nullable) ? "DROP NOT NULL" : "SET NOT NULL"; change.AddScript(DbScriptType.ColumnSetupComplete, "ALTER TABLE {0} ALTER COLUMN \"{1}\" {2};", column.Table.FullName, column.ColumnName, nullStr); }
public override void BuildColumnModifySql(DbObjectChange change, DbColumnInfo column, DbScriptOptions options = DbScriptOptions.None) { //SqlCe does not allow any modification of 'ntext'/memo columns var dbType = column.TypeInfo.VendorDbType.DbType; bool isNText = column.TypeInfo.Size < 0 && (dbType == DbType.String || dbType == DbType.Binary); if(isNText) { change.NotSupported("Modifying ntext column not supported in SqlCE. Column: {0}.{1}", column.Table.TableName, column.ColumnName); return; } base.BuildColumnModifySql(change, column, options); }
public override void BuildPrimaryKeyAddSql(DbObjectChange change, DbKeyInfo key) { // PK for Identity (Auto-increment) columns is created when table/ID columns is created if(key.KeyColumns[0].Column.Flags.IsSet(DbColumnFlags.Identity)) { change.AddScript(DbScriptType.PrimaryKeyAdd, "-- PrimaryKeyAdd empty action"); return; } var fullTableRef = key.Table.FullName; var pkFields = key.KeyColumns.GetSqlNameList(); // PK name is always 'PRIMARY' change.AddScript(DbScriptType.PrimaryKeyAdd, "ALTER TABLE {0} ADD CONSTRAINT PRIMARY KEY ({1});", fullTableRef, pkFields); }
public override void BuildColumnAddSql(DbObjectChange change, DbColumnInfo column, DbScriptOptions options) { var colSpec = GetColumnSpec(column, options); if(!column.Flags.IsSet(DbColumnFlags.Nullable)) { var dft = column.TypeInfo.VendorDbType.DefaultColumnInit; if (string.IsNullOrWhiteSpace(dft)) dft = column.TypeInfo.ToLiteral(new byte[] {0}); colSpec += " DEFAULT " + dft; } //workaround for unit test with renaming table - ignore rename, use old table var tbl = column.Table; if (tbl.Peer != null) tbl = tbl.Peer; //use old table name change.AddScript(DbScriptType.ColumnAdd, "ALTER TABLE {0} ADD {1};", tbl.FullName, colSpec); }
public override void BuildIndexAddSql(DbObjectChange change, DbKeyInfo key) { const string CreateIndexTemplate = @" CREATE {0} {1} INDEX {2} ON {3} ( {4} ) {5} {6} "; var unique = key.KeyType.IsSet(KeyType.Unique) ? "UNIQUE" : string.Empty; string clustered = GetClusteredExpression(key); var indexFields = key.KeyColumns.GetSqlNameListWithOrderSpec(); var qKeyName = '"' + key.Name + '"'; string includeList = string.Empty; if(key.IncludeColumns.Count > 0) includeList = "INCLUDE (" + key.IncludeColumns.GetSqlNameList() + ")"; string wherePred = string.Empty; if(!string.IsNullOrWhiteSpace(key.Filter)) wherePred = "WHERE " + key.Filter; var phase = key.KeyType.IsSet(KeyType.Clustered) ? ApplyPhase.Early : ApplyPhase.Default; change.AddScript(DbScriptType.IndexAdd, phase, CreateIndexTemplate, unique, clustered, qKeyName, key.Table.FullName, indexFields, includeList, wherePred); }
public override void BuildViewAddSql(DbObjectChange change, DbTableInfo view) { const string createViewTemplate = @"CREATE {0} VIEW {1} AS {2}; COMMENT ON {0} VIEW {1} IS '{3}'; "; //notice - no ';' at the end, SQL must have it already // For indexed views add 'MATERIALIZED' attribute var matz = view.IsMaterializedView ? "MATERIALIZED" : string.Empty; //var escapedSql = view.ViewSql.Replace("'", "''"); change.AddScript(DbScriptType.ViewAdd, createViewTemplate, matz, view.FullName, view.ViewSql, view.ViewHash); }
public override void BuildTableRenameSql(DbObjectChange change, DbTableInfo oldTable, DbTableInfo newTable) { change.AddScript(DbScriptType.TableRename, "ALTER TABLE {0} RENAME TO \"{1}\" ;", oldTable.FullName, newTable.TableName); }
//Helper methods protected virtual void BuildColumnRenameSqlWithAddDrop(DbObjectChange change, DbColumnInfo oldColumn, DbColumnInfo newColumn) { //Add new column BuildColumnAddSql(change, newColumn, DbScriptOptions.ForceNull); // copy data change.AddScript(DbScriptType.ColumnCopyValues, "UPDATE {0} SET \"{1}\" = \"{2}\";", oldColumn.Table.FullName, newColumn.ColumnName, oldColumn.ColumnName); // finalize added column BuildColumnModifySql(change, newColumn, DbScriptOptions.CompleteColumnSetup); //drop old column BuildColumnDropSql(change, oldColumn); }
public override void BuildSequenceDropSql(DbObjectChange change, DbSequenceInfo sequence) { // PG creates sequences for identity columns, these should not be dropped explicitly; we do sequence drop after table drop, so we add check for existense change.AddScript(DbScriptType.SequenceDrop, "DROP SEQUENCE IF EXISTS {0}", sequence.FullName); }
public override void BuildSequenceAddSql(DbObjectChange change, DbSequenceInfo sequence) { var start = (sequence.StartValue < 1) ? 1 : sequence.StartValue; const string sqlTemplate = "CREATE Sequence {0} START WITH {1} INCREMENT BY {2};"; change.AddScript(DbScriptType.SequenceAdd, sqlTemplate, sequence.FullName, start, sequence.Increment); }
public virtual void BuildCustomTypeDropSql(DbObjectChange change, DbCustomTypeInfo typeInfo) { }
//ALTER TABLE employees DROP COLUMN [employee_pwd]; public virtual void BuildColumnDropSql(DbObjectChange change, DbColumnInfo column) { //Note: the column drop comes after table-rename, so it might be table is already renamed, and we have to get its new name var tableName = column.Table.Peer.FullName; //new name if renamed change.AddScript(DbScriptType.ColumnDrop, "ALTER TABLE {0} DROP COLUMN \"{1}\"", tableName, column.ColumnName); }
public override void BuildColumnRenameSql(DbObjectChange change, DbColumnInfo oldColumn, DbColumnInfo newColumn) { change.AddScript(DbScriptType.ColumnRename, "ALTER TABLE {0} RENAME COLUMN \"{1}\" TO \"{2}\";", newColumn.Table.FullName, oldColumn.ColumnName, newColumn.ColumnName); }
public virtual void BuildColumnRenameSql(DbObjectChange change, DbColumnInfo oldColumn, DbColumnInfo newColumn) { Util.Throw("Column renaming is not supported by DbDriver {0}.", this.GetType()); }
public override void BuildViewDropSql(DbObjectChange change, DbTableInfo view) { var matzed = view.IsMaterializedView ? "MATERIALIZED" : string.Empty; change.AddScript(DbScriptType.ViewDrop, "DROP {0} VIEW {1};", matzed, view.FullName); //base.BuildViewDropSql(change, view); }
public virtual void BuildIndexAddSql(DbObjectChange change, DbKeyInfo key) { const string CreateIndexTemplate = @" CREATE {0} INDEX {1} ON {2} ( {3} ) {4} {5} "; var driver = this.Settings.Driver; var unique = key.KeyType.IsSet(KeyType.Unique) ? "UNIQUE" : string.Empty; string indexFields; if(driver.Supports(DbFeatures.OrderedColumnsInIndexes)) indexFields = key.KeyColumns.GetSqlNameListWithOrderSpec(); else indexFields = key.KeyColumns.GetSqlNameList(); var qKeyName = '"' + key.Name + '"'; string includeList = string.Empty; if(key.IncludeColumns.Count > 0 && driver.Supports(DbFeatures.IncludeColumnsInIndexes)) includeList = "INCLUDE (" + key.IncludeColumns.GetSqlNameList() + ")"; string wherePred = string.Empty; if(!string.IsNullOrWhiteSpace(key.Filter) && driver.Supports(DbFeatures.FilterInIndexes)) wherePred = "WHERE " + key.Filter; change.AddScript(DbScriptType.IndexAdd, CreateIndexTemplate, unique, qKeyName, key.Table.FullName, indexFields, includeList, wherePred); }
//Dropping objects ----------------------------------------------------------------------------------------------------- public virtual void BuildDatabaseDropSql(DbObjectChange change, string name) { change.AddScript(DbScriptType.DatabaseDrop, "DROP DATABASE \"{0}\";", name); }
}//method //Analyzes changes in columns and keys, but not ref constraints private DbTableChangeGroup AnalyzeTableChanges(DbTableInfo oldTable) { var tableChangeGrp = new DbTableChangeGroup(oldTable, oldTable.Peer); if (oldTable.Peer == null) { //Table deleted ----------------------------------------------------------------------------------- if (_dropUnknown) { tableChangeGrp.Changes.Add(new DbObjectChange(oldTable, null, DbObjectChangeType.Drop)); //delete keys - all except primary key - it is deleted automatically with the table; foreign keys are deleted with constraints foreach (var oldKey in oldTable.Keys) { _changedKeys.Add(oldKey); if (!oldKey.KeyType.IsSet(KeyType.PrimaryKey | KeyType.ForeignKey)) { tableChangeGrp.AddChange(oldKey, null); } } foreach (var cmd in oldTable.CrudCommands) { tableChangeGrp.AddChange(cmd, null); } } return(tableChangeGrp); } //Table/View modified? ----------------------------------------------------------------------------------- var newTable = oldTable.Peer; if (_compareTables) { //Check table rename string descr; if (!NamesMatch(oldTable.TableName, oldTable.Peer.TableName)) { descr = string.Format("Renamed {0} to {1}", oldTable.TableName, oldTable.Peer.TableName); var tableRename = new DbObjectChange(oldTable, oldTable.Peer, DbObjectChangeType.Rename, descr); tableChangeGrp.Changes.Add(tableRename); } // Internals of the table or view switch (oldTable.Kind) { case EntityKind.View: if (!ViewsMatch(oldTable, oldTable.Peer)) { tableChangeGrp.AddChange(oldTable, null, DbObjectChangeType.Drop); tableChangeGrp.AddChange(null, oldTable.Peer, DbObjectChangeType.Add); } break; case EntityKind.Table: foreach (var oldCol in oldTable.Columns) { if (oldCol.Peer == null) { _changedColumns.Add(oldCol); tableChangeGrp.AddChange(oldCol, null); } else { //Check column rename if (!NamesMatch(oldCol.ColumnName, oldCol.Peer.ColumnName)) { tableChangeGrp.AddChange(oldCol, oldCol.Peer, DbObjectChangeType.Rename); } if (!ColumnsMatch(oldCol, oldCol.Peer, out descr)) { _changedColumns.Add(oldCol); tableChangeGrp.AddChange(oldCol, oldCol.Peer, notes: descr); } } } //foreach col //new columns foreach (var newCol in newTable.Columns) { if (newCol.Peer == null) //if not null - it is already taken care of { tableChangeGrp.AddChange(null, newCol); } } break; } //switch oldTable.Kind //Check table columns } // if compareTables //Detect all changed keys, indexes; skip Foreign keys - they're not real keys // We do not modify keys, only drop/create them if anything mismatches; // key.Peer is set only if the keys did not change and non of the columns changed foreach (var key in oldTable.Keys) { bool changed = key.Peer == null || KeyChanged(key); if (!changed) { continue; } _changedKeys.Add(key); if (key.KeyType.IsSet(KeyType.ForeignKey) || IsPureIndex(key) && !_compareIndexes) { continue; } tableChangeGrp.AddChange(key, key.Peer); } foreach (var key in newTable.Keys) { if (key.Peer != null) { continue; //if Peer != null, it is already included in previous loop } if (key.KeyType.IsSet(KeyType.ForeignKey) || IsPureIndex(key) && !_compareIndexes) { continue; } tableChangeGrp.AddChange(null, key); } // CRUD stored procs if (_compareStoredProcs) { var oldUseProcs = _oldModel.Config.Options.IsSet(DbOptions.UseStoredProcs); var newUseProcs = _newModel.Config.Options.IsSet(DbOptions.UseStoredProcs); if (oldUseProcs || newUseProcs) { var forceRebuildProcs = tableChangeGrp.Changes.Count > 0; foreach (var cmd in newTable.CrudCommands) { if (cmd.CommandType != System.Data.CommandType.StoredProcedure) { continue; } if (cmd.Peer != null && StoredProceduresMatch(cmd.Peer, cmd)) { continue; } tableChangeGrp.AddChange(cmd.Peer, cmd); } } //if useProcs // End table modified case ------------------------------------------------------------------------ } //stored procs return(tableChangeGrp); }
internal DbObjectChange AddChange(DbModelObjectBase oldObj, DbModelObjectBase newObj, DbObjectChangeType? changeType = null, string notes = null) { var change = new DbObjectChange(oldObj, newObj, changeType, notes); this.Changes.Add(change); return change; }
public override void BuildIndexDropSql(DbObjectChange change, DbKeyInfo key) { change.AddScript(DbScriptType.IndexDrop, "DROP INDEX \"{0}\".\"{1}\";", key.Table.Schema, key.Name); }
}//method //Analyzes changes in columns and keys, but not ref constraints private DbTableChangeGroup AnalyzeTableChanges(DbTableInfo oldTable) { var tableChangeGrp = new DbTableChangeGroup(oldTable, oldTable.Peer); if (oldTable.Peer == null) { //Table deleted ----------------------------------------------------------------------------------- if (_dropUnknown) { tableChangeGrp.Changes.Add(new DbObjectChange(oldTable, null, DbObjectChangeType.Drop)); //delete keys - all except primary key - it is deleted automatically with the table; foreign keys are deleted with constraints foreach (var oldKey in oldTable.Keys) { _changedKeys.Add(oldKey); if (!oldKey.KeyType.IsSet(KeyType.PrimaryKey | KeyType.ForeignKey)) { tableChangeGrp.AddChange(oldKey, null); } } } return(tableChangeGrp); } //Table/View modified? ----------------------------------------------------------------------------------- var newTable = oldTable.Peer; if (_compareTables) { //Check table rename string descr; if (!NamesMatch(oldTable.TableName, oldTable.Peer.TableName)) { descr = string.Format("Renamed {0} to {1}", oldTable.TableName, oldTable.Peer.TableName); var tableRename = new DbObjectChange(oldTable, oldTable.Peer, DbObjectChangeType.Rename, descr); tableChangeGrp.Changes.Add(tableRename); } // Internals of the table or view switch (oldTable.Kind) { case EntityKind.View: if (_compareViews && !ViewsMatch(oldTable, oldTable.Peer)) { tableChangeGrp.AddChange(oldTable, null, DbObjectChangeType.Drop); tableChangeGrp.AddChange(null, oldTable.Peer, DbObjectChangeType.Add); } break; case EntityKind.Table: foreach (var oldCol in oldTable.Columns) { if (oldCol.Peer == null) { oldCol.Flags |= DbColumnFlags.IsChanging; tableChangeGrp.AddChange(oldCol, null); } else { //Check column rename if (!NamesMatch(oldCol.ColumnName, oldCol.Peer.ColumnName)) { tableChangeGrp.AddChange(oldCol, oldCol.Peer, DbObjectChangeType.Rename); } if (!_comparer.ColumnsMatch(oldCol, oldCol.Peer, out descr)) { oldCol.Flags |= DbColumnFlags.IsChanging; tableChangeGrp.AddChange(oldCol, oldCol.Peer, notes: descr); } } } //foreach col //new columns foreach (var newCol in newTable.Columns) { if (newCol.Peer == null) //if not null - it is already taken care of { tableChangeGrp.AddChange(null, newCol); } } break; } //switch oldTable.Kind //Check table columns } // if compareTables //Detect all changed keys, indexes; skip Foreign keys - they're not real keys // We do not modify keys, only drop/create them if anything mismatches; // key.Peer is set only if the keys did not change and non of the columns changed foreach (var oldKey in oldTable.Keys) { bool changed = oldKey.Peer == null || !_comparer.KeysMatch(oldKey, oldKey.Peer); if (!changed) { continue; } _changedKeys.Add(oldKey); if (oldKey.KeyType.IsSet(KeyType.ForeignKey) || IsPureIndex(oldKey) && !_compareIndexes) { continue; } tableChangeGrp.AddChange(oldKey, oldKey.Peer); } foreach (var key in newTable.Keys) { if (key.Peer != null) { continue; //if Peer != null, it is already included in previous loop } //ignore primary key on Views - this is artificial attribute, used on CLR side only if (newTable.Kind == EntityKind.View && key.KeyType.IsSet(KeyType.PrimaryKey)) { continue; } if (key.KeyType.IsSet(KeyType.ForeignKey) || IsPureIndex(key) && !_compareIndexes) { continue; } tableChangeGrp.AddChange(null, key); } return(tableChangeGrp); }
public override void BuildPrimaryKeyAddSql(DbObjectChange change, DbKeyInfo key) { base.BuildPrimaryKeyAddSql(change, key); if(key.KeyType.IsSet(KeyType.Clustered)) change.AddScript(DbScriptType.PrimaryKeyAdd, "ALTER TABLE {0} CLUSTER ON \"{1}\";", key.Table.FullName, key.Name); }
public virtual void BuildDatabaseAddSql(DbObjectChange change, string name) { change.AddScript(DbScriptType.DatabaseAdd, "CREATE DATABASE \"{0}\"", name); }
public virtual void BuildColumnSetDefaultValuesSql(DbObjectChange change, DbColumnInfo column) { var fullTableRef = column.Table.FullName; change.AddScript(DbScriptType.ColumnInit, "UPDATE {0} SET \"{1}\" = {2} WHERE \"{1}\" IS NULL;", fullTableRef, column.ColumnName, column.TypeInfo.InitExpression); }