addFKto method

IntColumn addFKto(
  1. Table table,
  2. String name, {
  3. bool allowNull = false,
  4. bool unique = false,
  5. IntegrityRule onUpdate = IntegrityRule.cascade,
  6. IntegrityRule onDelete = IntegrityRule.cascade,
})
adds a new fk to the table and adds the field to fields list, specifying it's name in the db

Implementation

IntColumn addFKto(Table table, String name,
    {bool allowNull = false,
    bool unique = false,
    IntegrityRule onUpdate = IntegrityRule.cascade,
    IntegrityRule onDelete = IntegrityRule.cascade}) {
  IntColumn tmp = db.intColumn(name, allowNull: allowNull, unique: unique);

  this.fields.add(tmp);

  this.FKs.add(new _ForeignKey(tmp, table, onUpdate: onUpdate, onDelete: onDelete));
  tmp._setTable(this);
  return tmp;
}