clrghouz/database/migrations/2023_07_11_222130_packet_logging.php

72 lines
1.9 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('system_transfers',function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('packet')->nullable();
$table->bigInteger('file_id')->nullable();
$table->foreign('file_id')->references('id')->on('files');
$table->bigInteger('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->unique(['address_id','packet']);
$table->unique(['address_id','file_id']);
});
*/
Schema::table('netmails',function (Blueprint $table) {
$table->bigInteger('send_id')->nullable()->after('send_pkt');
$table->foreign('send_id')->references('id')->on('addresses');
});
Schema::table('netmail_path',function (Blueprint $table) {
$table->string('recv_pkt')->nullable();
$table->bigInteger('recv_id')->nullable();
$table->foreign('recv_id')->references('id')->on('addresses');
$table->unique(['recv_id','netmail_id']);
});
DB::statement('ALTER TABLE echomail_seenby RENAME COLUMN packet TO sent_pkt');
Schema::table('echomail_seenby',function (Blueprint $table) {
$table->bigInteger('sent_id')->nullable();
$table->foreign('sent_id')->references('id')->on('addresses');
$table->unique(['sent_id','echomail_id']);
});
Schema::table('echomail_path',function (Blueprint $table) {
$table->string('recv_pkt')->nullable();
$table->bigInteger('recv_id')->nullable();
$table->foreign('recv_id')->references('id')->on('addresses');
$table->unique(['recv_id','echomail_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//Schema::dropIfExists('system_transfers');
}
};