Skip to content

Instantly share code, notes, and snippets.

@reshadman
Created February 18, 2014 05:58
Show Gist options
  • Save reshadman/9065392 to your computer and use it in GitHub Desktop.
Save reshadman/9065392 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Migrations\Migration;
class CreatePersRolesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//Schema::drop('pers_roles');
Schema::create('pers_roles',function($table){
$table->integer('per_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');;
$table->foreign('per_id')->references('id')->on('pers')->onDelete('cascade');;
$table->unique(array('per_id','role_id'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pers_roles');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment