vd/database/migrations/2018_11_27_175152_create_package_tables.php
2018-11-28 15:37:05 +08:00

48 lines
1.3 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) {
$table->string('package_id', 20)->comment('套餐编号');
$table->string('sim', 20)->comment('sim卡号');
$table->primary(['package_id', 'sim']);
});
db_alter($table_name, $table_comment);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
foreach ($this->tables as $table_name => $table_comment) {
Schema::dropIfExists($table_name);
}
}
}