DBIO-MySQL

 view release on metacpan or  search on metacpan

t/40-diff.t  view on Meta::CPAN

      to_table     => 'other',
      to_columns   => ['id'],
      on_update    => 'NO ACTION',
      on_delete    => 'CASCADE',
    }]},
    { t => {} }, { t => {} },
  );
  is(scalar @ops, 1, 'one fk add');
  my $sql = $ops[0]->as_sql;
  like($sql, qr/ADD CONSTRAINT `fk_t_other` FOREIGN KEY \(`other_id`\) REFERENCES `other`\(`id`\)/, 'add fk');
  like($sql, qr/ON DELETE CASCADE/, 'on delete cascade');
  unlike($sql, qr/ON UPDATE/, 'on update NO ACTION omitted');
}

# --- Diff::ForeignKey drop ---
{
  my @ops = DBIO::MySQL::Diff::ForeignKey->diff(
    { t => [{
      constraint_name => 'fk_old', from_columns => ['x'],
      to_table => 'other', to_columns => ['id'],
    }]},



( run in 1.353 second using v1.01-cache-2.11-cpan-7fcb06a456a )