I was wondering why varchar isn't supported by phinx. My database makes extensive use of it, and I would love to be able to use the change() command instead of just running a query in up() and down()
tested on mysql, 'string' column type actually produce varchar
$this->table('my_table', ['id' => 'my_table_id'])->addColumn('name', 'string')->create();
perhaps it will be good to have varchar aliases in the column datatypes.
AdapterInterface::PHINX_TYPE_STRING is what should be used. This is the engine agnostic way to say you want a variable length string as not all database engines use the keyword varchar.
Wait what.... It's literally not supported?
It is, it's just not referred to varchar, rather string (or AdapterInterface::PHINX_TYPE_STRING which maps to string), which phinx uses as an engine agnostic way to refer to string/varchar columns.
$this->table('tags')->addColumn('short_name', 'string', ['limit' => 30])
->create();
that will give you a table tags with a varchar(30) column.
@chrissound Please open a new issue if you have a problem to discuss. We don't encourage discussion in closed issues.
Most helpful comment
tested on mysql, 'string' column type actually produce varchar
$this->table('my_table', ['id' => 'my_table_id'])->addColumn('name', 'string')->create();perhaps it will be good to have varchar aliases in the column datatypes.