pla-version/database/migrations/2023_03_02_230700_visitor_tables.php

40 lines
855 B
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('sites', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->ipAddress('ip_address');
});
Schema::create('site_versions', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('version');
$table->json('response')->nullable();
$table->bigInteger('site_id');
$table->foreign('site_id')->references('id')->on('sites');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('site_versions');
Schema::dropIfExists('sites');
}
};