akaunting/database/migrations/2019_11_14_000000_create_firewall_table.php

55 lines
1.4 KiB
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
2019-12-16 12:04:27 +03:00
use Illuminate\Support\Facades\Schema;
2019-11-16 10:21:14 +03:00
class CreateFirewallTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('firewall_ips', function (Blueprint $table) {
$table->increments('id');
$table->string('ip');
$table->integer('log_id')->nullable();
$table->boolean('blocked')->default(1);
$table->timestamps();
$table->softDeletes();
$table->index('ip');
$table->unique(['ip', 'deleted_at']);
});
Schema::create('firewall_logs', function (Blueprint $table) {
$table->increments('id');
$table->string('ip');
$table->string('level')->default('medium');
$table->string('middleware');
$table->integer('user_id')->nullable();
$table->string('url')->nullable();
$table->string('referrer')->nullable();
$table->text('request')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index('ip');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('firewall_ips');
Schema::drop('firewall_logs');
}
}