57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateBannerTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
if (!Schema::hasTable('banner_ads')) {
|
|
Schema::create('banner_ads', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('name')->comment('名称');
|
|
$table->string('key')->unique()->comment('key');
|
|
$table->unsignedInteger('width')->nullable()->comment('宽');
|
|
$table->unsignedInteger('height')->nullable()->comment('高');
|
|
$table->unsignedTinyInteger('is_enable')->default(1)->comment('可用状态');
|
|
$table->string('remarks')->nullable()->comment('备注');
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
if (!Schema::hasTable('banners')) {
|
|
Schema::create('banners', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('ad_id')->comment('位置ID');
|
|
$table->string('path')->comment('地址');
|
|
$table->string('name')->nullable()->comment('名称');
|
|
$table->unsignedInteger('sort')->default(1)->comment('排序(asc)');
|
|
$table->unsignedTinyInteger('is_enable')->default(1)->comment('可用状态');
|
|
$table->text('ext')->nullable()->comment('扩展字段,可用于跳转配置等');
|
|
$table->string('remarks')->nullable()->comment('备注');
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('banners');
|
|
Schema::dropIfExists('banner_ads');
|
|
}
|
|
};
|