forms/migrations/FormsInputMigration.php

36 lines
1.1 KiB
PHP
Raw Normal View History

2024-05-28 17:10:06 +03:00
<?php
namespace itguild\forms\form\migrations;
use Illuminate;
use Illuminate\Database\Schema\Blueprint;
class FormsInputMigration extends Illuminate\Database\Migrations\Migration
{
public static function up(): void
{
Illuminate\Database\Capsule\Manager::schema()->create("form_input", function (Blueprint $table) {
$table->id("id");
$table->unsignedBigInteger('form_id');
$table->unsignedBigInteger('input_type_id');
$table->string('label');
$table->string('name');
$table->text('params');
$table->integer(11)->default(1);
$table->timestamps();
$table->index('form_id');
$table->index('input_type_id');
$table->foreign('form_id', 'fk_form_input_form')->references('id')->on('form');
$table->foreign('input_type_id', 'fk_form_input_input_type')->references('id')->on('input_type');
});
}
public static function down(): void
{
Illuminate\Database\Capsule\Manager::schema()->drop("form_input");
}
}