lk.zachem.info/database/migrations/2024_07_04_052702_create_complexes_table.php
2024-11-25 15:39:54 +03:00

39 lines
1.1 KiB
PHP

<?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('complexes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->foreignId('city_id')->references('id')->on('cities')->onDelete('cascade');
$table->string('bitrix_id')->nullable();
$table->timestamps();
});
DB::table('complexes')->insert([
['name' => 'Академик Иркутск', 'city_id' => 1],
['name' => 'Автор Иркутск', 'city_id' => 1],
['name' => 'Атмосфера Хабаровск', 'city_id' => 2],
['name' => 'Аккорд Хабаровск', 'city_id' => 2],
['name' => 'Адмирал Хабаровск', 'city_id' => 2]
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('resident_complexes');
}
};