public IEnumerable<string> ToSql(IProvider provider, IRuntimeContext context) { if (_columnNames.Count == 0) { throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command."); } string effectiveConstraintName = GetEffectiveConstraintName(); return provider.AddForeignKey(Parent.TableName, _referencedTableName, _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName, CascadeOnDelete); }
public IEnumerable <string> ToSql(IProvider provider, IMigrationContext context) { if (_columnNames.Count == 0) { throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command."); } string effectiveConstraintName = GetEffectiveConstraintName(); return(provider.AddForeignKey(new TableName(Parent.TableName, Parent.Schema ?? context.GetDefaultSchema()), new TableName(_referencedTableName, ReferencedTableSchema ?? Parent.Schema ?? context.GetDefaultSchema()), _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName, CascadeOnDelete)); }
public IEnumerable <string> ToSql(IProvider provider, IRuntimeContext context) { if (_columnNames.Count == 0) { throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command."); } string effectiveConstraintName = GetEffectiveConstraintName(); return(provider.AddForeignKey(Parent.TableName, _referencedTableName, _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName)); }