1: <?php
2:
3: use Illuminate\Database\Schema\Blueprint;
4: use Illuminate\Database\Migrations\Migration;
5:
6: class CreateUserPermissionsTable extends Migration {
7:
8: /**
9: * Run the migrations.
10: *
11: * @access public
12: * @return void
13: */
14: public function up()
15: {
16: if (!Schema::hasTable('_db_user_permissions'))
17: {
18: Schema::create('_db_user_permissions', function ($table)
19: {
20: $table->increments('id')->unique();
21: $table->integer('user_id')->unsigned();
22: $table->integer('table_id')->unsigned();
23: $table->integer('action_id')->unsigned();
24: $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
25: $table->timestamp('updated_at')->default('0000-00-00 00:00:00');
26: /*
27: $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
28: $table->foreign('table_id')->references('id')->on('_db_tables')->onDelete('cascade');
29: $table->foreign('action_id')->references('id')->on('_db_actions')->onDelete('cascade');
30: */
31: });
32: }
33: }
34:
35: /**
36: * Reverse the migrations.
37: *
38: * @access public
39: * @return void
40: */
41: public function down()
42: {
43: Schema::dropIfExists('_db_user_permissions');
44: }
45:
46: }
47: