123456789101112131415161718192021222324252627282930313233 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- return new class extends Migration
- {
- /**
- * Run the migrations.
- */
- public function up(): void
- {
- Schema::create('custom_fields', function (Blueprint $table) {
- $table->id();
- $table->string('group', 50);
- $table->string('key', 50);
- $table->json('label')->nullable();
- $table->tinyInteger('type')->default(1)->comment('1: text, 2: textarea, 3: select, 4: number');
- $table->json('options')->nullable();
- $table->tinyInteger('required')->default(0)->comment('0: no, 1: yes');
- $table->unique(['group', 'key']);
- });
- }
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('custom_fields');
- }
- };
|