47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Dicts;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreatePackageTables extends Migration
|
|
{
|
|
protected $tables = [
|
|
'real_package_renewal_cards' => '卡关联续费套餐',
|
|
'real_package_renewal_package_cards' => '卡关联续费包套餐',
|
|
'real_package_flows_package_cards' => '卡关联加油包套餐',
|
|
'real_package_optional_package_cards' => '卡关联可选包套餐',
|
|
'real_package_additional_package_cards' => '卡关联附加套餐',
|
|
];
|
|
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
foreach ($this->tables as $table_name => $table_comment) {
|
|
Schema::create($table_name, function (Blueprint $table) use ($table_comment) {
|
|
$table->integer('package_id')->unsigned()->default(0)->comment('套餐ID');
|
|
$table->bigInteger('sim')->unsigned()->default(0)->comment('SIM卡号');
|
|
$table->primary(['package_id', 'sim']);
|
|
$table->comment($table_comment);
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
foreach ($this->tables as $table_name => $table_comment) {
|
|
Schema::dropIfExists($table_name);
|
|
}
|
|
}
|
|
}
|