This commit is contained in:
2025-07-14 12:15:41 +03:00
parent a64ed080bb
commit 273ac72207
974 changed files with 483955 additions and 14 deletions

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*/
public function up(): void
{
\kernel\App::$db->schema->create('custom_field', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique(); // Название поля (например, 'phone')
$table->string('type')->default('string'); // Тип поля (string, integer, boolean и т.д.)
$table->string('entity')->nullable(true); // Сущность (user, post и т.д.)
$table->string('label'); // Человекочитаемое название
$table->text('field_options'); // Человекочитаемое название
$table->integer('status')->default(1);
$table->timestamps();
});
\kernel\App::$db->schema->create('user_custom_values', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('custom_field_id');
$table->text('value')->nullable();
$table->timestamps();
// $table->foreign('user_id')->references('id')->on('user')->onDelete('cascade');
// $table->foreign('custom_field_id')->references('id')->on('custom_field')->onDelete('cascade');
// $table->unique(['user_id', 'custom_field_id']); // Уникальная пара пользователь-поле
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
\kernel\App::$db->schema->dropIfExists('user_custom_values');
\kernel\App::$db->schema->dropIfExists('custom_field');
}
};