mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added DB migration for remote_ip, action_source, user_agent in logs
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
6b4bc9723c
commit
4dac3712a6
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRemoteIpAndActionSourceToActionLogs extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('action_logs', function (Blueprint $table) {
|
||||
$table->string('action_source')->nullable()->default(null);
|
||||
$table->ipAddress('remote_ip')->nullable()->default(null);
|
||||
$table->string('user_agent')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('action_logs', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('action_logs', 'action_source')) {
|
||||
$table->dropColumn('action_source');
|
||||
}
|
||||
if (Schema::hasColumn('action_logs', 'remote_ip')) {
|
||||
$table->dropColumn('remote_ip');
|
||||
}
|
||||
if (Schema::hasColumn('action_logs', 'user_agent')) {
|
||||
$table->dropColumn('user_agent');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue