|
|
|
@@ -0,0 +1,44 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
use App\Util\MigrationHelper; |
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
|
|
use Illuminate\Support\Facades\Schema; |
|
|
|
|
|
|
|
return new class extends Migration |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Run the migrations. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function up() |
|
|
|
{ |
|
|
|
Schema::table('contracts', function (Blueprint $table) { |
|
|
|
$helper = new MigrationHelper($table); |
|
|
|
$table->string("contract_code")->nullable()->comment("契約識別子"); |
|
|
|
$helper->unique(1, ['contract_code']); |
|
|
|
}); |
|
|
|
Schema::table('contract_histories', function (Blueprint $table) { |
|
|
|
$table->string("contract_code")->nullable()->comment("契約識別子"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Reverse the migrations. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function down() |
|
|
|
{ |
|
|
|
Schema::table('contracts', function (Blueprint $table) { |
|
|
|
$helper = new MigrationHelper($table); |
|
|
|
$table->dropColumn("contract_code"); |
|
|
|
|
|
|
|
$helper->dropIndex(1); |
|
|
|
}); |
|
|
|
Schema::table('contract_histories', function (Blueprint $table) { |
|
|
|
$table->dropColumn("contract_code"); |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |