Hiya! I've added a model with some fields. However I forgot some fields and want to add them using a migration. Thus, I've generated a migration (php oil g migration). However I'm unable to find a function (in DBUtil) which can add a field to my table. Anything I'm missing? I don't want to drop and create the table (and lose all of my data) just for re-structuring.
Thanks!
I get blank methods in the generated file when following the instructions for running oil from the command line - but they should look something like this:
<?php
namespace Fuel\Migrations;
class Add_status_to_project {
public function up()
{
\DB::query('ALTER TABLE `projects` ADD `status` VARCHAR( 25 );')->execute();
}
public function down()
{
\DB::query('ALTER TABLE `projects` DROP `status`')->execute();
}
}
Right you are. I was actually unpleasantly surprised yesterday to discover that DBUtil does not actually have any functionality to add fields to a table. I'm pretty sure this is not me missing it, but its nowhere I could find.
When the add_fields methods are added I will make sure that the magic migration - mentioned (brilliant username, but I'll have to validate against that) works.