vd/database/migrations/2019_04_02_101740_create_property_tables.php
2020-01-06 21:51:10 +08:00

59 lines
2.1 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePropertyTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('virtual_properties')) {
Schema::create('virtual_properties', function (Blueprint $table) {
$table->increments('id')->comment('自增ID');
$table->integer('company_id')->unsigned()->default(0)->comment('企业ID');
$table->integer('package_id')->unsigned()->default(0)->comment('套餐ID');
$table->string('product', 100)->default('')->comment('产品类型');
$table->string('vehicle', 100)->default('')->comment('车辆类型');
$table->string('commercial_vehicle', 100)->default('')->comment('商用车分类');
$table->string('company', 100)->default('')->comment('公司类型');
$table->string('platform', 100)->default('')->comment('平台/API类型');
$table->string('customer', 100)->default('')->comment('客户类型');
$table->string('package', 100)->default('')->comment('套餐分类');
$table->text('province')->nullable()->comment('省份设置');
$table->timestamps();
$table->unique(['company_id', 'package_id']);
$table->comment('企业套餐卡属性配置');
});
}
if (!Schema::hasTable('virtual_property_settings')) {
Schema::create('virtual_property_settings', function (Blueprint $table) {
$table->string('name', 20)->default('');
$table->text('value')->nullable();
$table->primary('name');
$table->comment('卡属性分类配置');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('virtual_property_settings');
Schema::dropIfExists('virtual_properties');
}
}