123456789101112131415161718192021222324252627282930313233343536 |
- <?php
-
- use Illuminate\Support\Facades\Schema;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class CreatePermissionsTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('permissions', function (Blueprint $table) {
- $table->bigIncrements('id');
- $table->unsignedBigInteger('user_id');
- $table->unsignedTinyInteger('level');
- $table->unsignedBigInteger('division_id');
-
- $table->unique(['user_id', 'level', 'division_id']);
- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('permissions');
- }
- }
|