52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Database\Migrations\Migration;
 | |
| use Illuminate\Database\Schema\Blueprint;
 | |
| 
 | |
| class CreateModulesTable extends Migration
 | |
| {
 | |
|     /**
 | |
|      * Run the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function up()
 | |
|     {
 | |
|         Schema::create('modules', function (Blueprint $table) {
 | |
|             $table->increments('id');
 | |
|             $table->integer('company_id');
 | |
|             $table->string('alias');
 | |
|             $table->integer('status');
 | |
|             $table->timestamps();
 | |
|             $table->softDeletes();
 | |
| 
 | |
|             $table->index('company_id');
 | |
|             $table->unique(['company_id', 'alias', 'deleted_at']);
 | |
|         });
 | |
| 
 | |
|         Schema::create('module_histories', function (Blueprint $table) {
 | |
|             $table->increments('id');
 | |
|             $table->integer('company_id');
 | |
|             $table->integer('module_id');
 | |
|             $table->string('category');
 | |
|             $table->string('version');
 | |
|             $table->text('description')->nullable();
 | |
|             $table->timestamps();
 | |
|             $table->softDeletes();
 | |
| 
 | |
|             $table->index(['company_id', 'module_id']);
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function down()
 | |
|     {
 | |
|         Schema::drop('modules');
 | |
|         Schema::drop('module_histories');
 | |
|     }
 | |
| }
 |