Added place edit function
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('places', function (Blueprint $create) {
|
||||
$create->id();
|
||||
|
||||
// Основные поля
|
||||
$create->string('name', 512)->nullable();
|
||||
$create->string('address', 512)->nullable();
|
||||
$create->string('phone', 128)->nullable();
|
||||
$create->string('gps', 512)->nullable();
|
||||
$create->string('url', 255)->nullable();
|
||||
$create->text('description')->nullable();
|
||||
|
||||
// Даты (Laravel по умолчанию использует timestamp,
|
||||
// но здесь приведены к вашему формату datetime)
|
||||
$create->datetime('created_at')->useCurrent();
|
||||
$create->datetime('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$create->softDeletes(); // Это поле deleted_at
|
||||
|
||||
// Индексы с ограничением длины (как в вашем SQL)
|
||||
$create->index([DB::raw('name(255)')], 'idx_name');
|
||||
$create->index([DB::raw('gps(255)')], 'idx_gps');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('places');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user