add user_module migration

pull/1/head
farid saravi 5 years ago
parent f2bb4a68ad
commit a1fb1fdcb7

@ -9,6 +9,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0", "fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*", "laravel/framework": "5.8.*",
"laravel/passport": "^7.3", "laravel/passport": "^7.3",

@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateModuleUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbName = config('core.db_name');
Schema::create("$dbName.module_user", function (Blueprint $table) {
$table->unsignedInteger('module_id');
$table->unsignedInteger('user_id');
$table->unique(['module_id', 'user_id']);
$table->index('module_id');
$table->index('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$dbName = config('core.db_name');
Schema::dropIfExists("$dbName.module_user");
}
}
Loading…
Cancel
Save