2022_03_17_144518_create_components_table.php 1.33 KB
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateComponentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('video_temp');

        Schema::create('video_temp', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->unsignedTinyInteger('state');
            $table->timestamps();
        });

        Schema::create('components', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('temp_id');
            $table->string('name')->comment('组件名称');
            $table->string('position')->nullable()->comment('位置');
            $table->unsignedTinyInteger('font_size')->default(12)->comment('字号');
            $table->string('text_color')->nullable()->comment('文字颜色');
            $table->string('text_bg_color')->nullable()->comment('文字背景色');
            $table->double('opacity')->nullable()->comment('透明度');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('components');
    }
}