From 16c645b4a09abf1433ac0b3e0799ced350c606b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 21 Jul 2022 00:25:45 +0300 Subject: [PATCH] added role_user migration.. --- .../migrations/2017_09_14_000000_core_v1.php | 3 +- .../2022_07_21_000000_core_v305.php | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2022_07_21_000000_core_v305.php diff --git a/database/migrations/2017_09_14_000000_core_v1.php b/database/migrations/2017_09_14_000000_core_v1.php index 047b7fbcc..3525b6ba4 100644 --- a/database/migrations/2017_09_14_000000_core_v1.php +++ b/database/migrations/2017_09_14_000000_core_v1.php @@ -410,11 +410,12 @@ return new class extends Migration Schema::create('user_roles', function (Blueprint $table) { $table->integer('user_id')->unsigned(); $table->integer('role_id')->unsigned(); + $table->string('user_type'); $table->foreign('role_id')->references('id')->on('roles') ->onUpdate('cascade')->onDelete('cascade'); - $table->primary(['user_id', 'role_id']); + $table->primary(['user_id', 'role_id', 'user_type']); }); // Reconciliations diff --git a/database/migrations/2022_07_21_000000_core_v305.php b/database/migrations/2022_07_21_000000_core_v305.php new file mode 100644 index 000000000..c140d0ce5 --- /dev/null +++ b/database/migrations/2022_07_21_000000_core_v305.php @@ -0,0 +1,35 @@ +dropPrimary(['user_id', 'role_id', 'user_type']); + $table->primary(['user_id', 'role_id']); + }); + + Schema::table('user_roles', function (Blueprint $table) { + $table->dropColumn('user_type'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +};