public SchemaBuilder CreateForeignKey(string name, string srcModule, string srcTable, string[] srcColumns, string destModule, string destTable, string[] destColumns) { var command = new CreateForeignKeyCommand(FormatTable(name), FormatTable(srcTable), srcColumns, FormatTable(destTable), destColumns); Execute(_builder.CreateSql(command)); return(this); }
public SchemaBuilder CreateForeignKey(string name, string srcModule, string srcTable, string[] srcColumns, string destModule, string destTable, string[] destColumns) { var command = new CreateForeignKeyCommand(name, String.Concat(_formatPrefix(srcModule), srcTable), srcColumns, String.Concat(_formatPrefix(destModule), destTable), destColumns); Run(command); return(this); }
public virtual IEnumerable <string> Run(CreateForeignKeyCommand command) { var builder = new StringBuilder(); builder.Append("alter table ") .Append(_dialect.QuoteForTableName(command.SrcTable)); builder.Append(_dialect.GetAddForeignKeyConstraintString(command.Name, command.SrcColumns.Select(x => _dialect.QuoteForColumnName(x)).ToArray(), _dialect.QuoteForTableName(command.DestTable), command.DestColumns.Select(x => _dialect.QuoteForColumnName(x)).ToArray(), false)); yield return(builder.ToString()); }
public SchemaBuilder CreateForeignKey(string name, string srcModule, string srcTable, string[] srcColumns, string destTable, string[] destColumns) { try { var command = new CreateForeignKeyCommand(Prefix(name), Prefix(srcTable), srcColumns, Prefix(destTable), destColumns); Execute(_builder.CreateSql(command)); } catch { if (ThrowOnError) { throw; } } return(this); }
public ISchemaBuilder CreateForeignKey(string name, string srcTable, string[] srcColumns, string destTable, string[] destColumns) { try { var command = new CreateForeignKeyCommand(Dialect.FormatKeyName(Prefix(name)), Prefix(srcTable), srcColumns, Prefix(destTable), destColumns); var sql = _commandInterpreter.CreateSql(command); Execute(sql); } catch { if (ThrowOnError) { throw; } } return(this); }
public override void Visit(CreateForeignKeyCommand command) { if (ExecuteCustomInterpreter(command)) { return; } var builder = new StringBuilder(); builder.Append("alter table ") .Append(_dialect.QuoteForTableName(PrefixTableName(command.SrcTable))); builder.Append(_dialect.GetAddForeignKeyConstraintString(PrefixTableName(command.Name), command.SrcColumns, _dialect.QuoteForTableName(PrefixTableName(command.DestTable)), command.DestColumns, false)); _sqlStatements.Add(builder.ToString()); RunPendingStatements(); }
public override void Visit(CreateForeignKeyCommand command) { _output.WriteLine("Creating foreign key {0}", command.Name); }
public string[] CreateStatements(CreateForeignKeyCommand command) { return(new string[0]); }
public override IEnumerable <string> Run(CreateForeignKeyCommand command) { yield break; }
public abstract void Visit(CreateForeignKeyCommand command);
public void Visit(CreateForeignKeyCommand command) { }