View file visavi-rotorcms-63832fa/app/database/migrations/20151214204632_add_fk_to_comments.php

File size: 411B
<?php

use Phinx\Migration\AbstractMigration;

class AddFkToComments extends AbstractMigration
{
	/**
	 * Change Method.
	 */
	public function change()
	{
		$table = $this->table('comments');
		$table
		->addForeignKey('user_id', 'users', 'id',
			['delete'=> 'cascade', 'update' => 'restrict'])
		->addForeignKey('relate_id', 'news', 'id',
			['delete'=> 'cascade', 'update' => 'restrict'])
		->update();
	}
}