pipicar/modules/owners/migrate.php

28 lines
1010 B
PHP

<?php
use A7kz\Platform\Modules\Platform\Segment\Facades\Segment;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$segments = Segment::listActive();
foreach ($segments as $segment) {
Schema::connection($segment->connector)->create('pipi_owners', static function (Blueprint $table) {
$table->id();
$table->string('fio')->nullable()->comment('ФИО владельца');
$table->string('contract_file_path')->nullable()->comment('Путь до договора');
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('user_id')->nullable()->comment('Пользователь в системе');
$table->foreign('user_id')->references('id')->on('core_users');
});
}
}
};