Seperti yang ditunjukkan igrossiter, ada metode untuk ini, nama metodenya adalah masukkan
use Phinx\Migration\AbstractMigration;
class NewStatus extends AbstractMigration
{
protected $statusId = 1234; //It'd be nice to use an entity constant instead of magic numbers, but that's up to you.
protected $statusName = 'In Progress';
/**
* Migrate Up.
*/
public function up()
{
$columns = ['id', 'name'];
$data = [[$this->statusId, $this->statusName]];
$table = $this->table('status');
$table->insert($columns, $data);
$table->saveData();
}
/**
* Migrate Down.
*/
public function down()
{
$this->execute('Delete from status where id = ' . $this->statusId);
}
}
Edit per 2 Desember 2015
Tanda tangan metode ini akan berubah di versi stabil mendatang menjadi sesuatu seperti
$data = [
['id' => 1, 'name' => 'foo'],
['id' => 2, 'name' => 'bar']
];
$table = $this->table('status');
$table->insert($data);