protected override void Generate(AddNotNullConstraint op) { FormattedSql sql = string.Format(@"UPDATE {0} SET {1} = {2} WHERE {1} IS NULL", this.Quote(op.TableName), this.Quote(op.ColumnName), "{0}"); sql.Parameters.Add(DbTypeHelper.GetDefaultValue(op.DataType)); this.AddRun(new FormattedSqlMigrationRun { Sql = sql }); this.AddNotNullConstraint(op); }
protected override void Generate(AddNotNullConstraint op) { using (var sql = this.Writer()) { string columnDefaultValue = this.GetDefaultValue(op.DataType); var text = string.Format(@"UPDATE {0} SET {1} = {2} WHERE {1} IS NULL", this.Quote(op.TableName), this.Quote(op.ColumnName), columnDefaultValue); sql.Write(text); this.AddRun(sql); } this.AddNotNullConstraint(op); }
protected override void Generate(AddNotNullConstraint op) { //SQLite 不支持 }
protected abstract void Generate(AddNotNullConstraint op);