3

I'm trying to create a migration in Phinx which will create a varbinary type field in a MySQL DB to store an ip_address.

This is what I have:

$table = $this->table('my_table');
$table->addColumn('ip_address', 'varbinary', ['after' => 'id', 'limit' => 16])
->save();

However this simply returns:

[InvalidArgumentException]
An invalid column type "varbinary" was specified for column "ip_address".

I tried using 'binary' but this just ended up as a BLOB. :/

Nathan Pitman
  • 2,286
  • 4
  • 30
  • 46

1 Answers1

6

Its currently not possible, I did however have the same problem and have just created a pull request for adding in this functionality: https://github.com/robmorgan/phinx/pull/811

It would let you add a varbinary field with code like you currently have.

$table->addColumn('ip', 'varbinary', ['length' => 16]);
Zortje
  • 511
  • 5
  • 3