Skip to content
Advertisement

Add column field to a table – cakephp 3

I need to alter a table to add a Column to it. I need to do it in cakephp 3. I have tried below code from Schema System Cakephp-3

$result = new Table('dummys');
$result->addColumn('my_field', ['type' => 'binary']);

This code should create a new Table with the field 'my_field' but its not doing that.

I have also tried it with already created table but still no luck.

Please help me on this guys as I need to create the field in table from Cakephp only.

Advertisement

Answer

This code should create a new Table with the field ‘my_field’ but its not doing that.

No, it should not.

You want migrations, not schema.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement