2016-09-06 19:39:42 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2021-06-10 13:15:52 -07:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
2016-09-06 19:39:42 -07:00
|
|
|
|
|
|
|
class CreateActionlogTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
if (! Schema::hasTable('action_logs')) {
|
2016-09-14 18:59:14 -07:00
|
|
|
Schema::create('action_logs', function (Blueprint $table) {
|
|
|
|
$table->increments('id');
|
|
|
|
$table->integer('user_id')->nullable();
|
|
|
|
$table->string('action_type');
|
|
|
|
$table->integer('target_id')->nullable(); // Was checkedout_to
|
2016-09-20 00:46:14 -07:00
|
|
|
$table->string('target_type')->nullable(); // For polymorphic thingies
|
2016-09-14 18:59:14 -07:00
|
|
|
$table->integer('location_id')->nullable();
|
|
|
|
$table->text('note')->nullable();
|
|
|
|
$table->text('filename')->nullable();
|
|
|
|
$table->string('item_type');
|
|
|
|
$table->integer('item_id'); // Replaces asset_id, accessory_id, etc.
|
|
|
|
$table->date('expected_checkin')->nullable()->default(null);
|
|
|
|
$table->integer('accepted_id')->nullable();
|
|
|
|
$table->timestamps();
|
|
|
|
$table->softDeletes();
|
2016-09-06 19:39:42 -07:00
|
|
|
|
2016-09-14 18:59:14 -07:00
|
|
|
$table->integer('thread_id')
|
|
|
|
->nullable()
|
|
|
|
->default(null);
|
|
|
|
$table->index('thread_id');
|
|
|
|
});
|
|
|
|
}
|
2016-09-06 19:39:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2016-09-14 18:59:14 -07:00
|
|
|
Schema::dropIfExists('action_logs');
|
2016-09-06 19:39:42 -07:00
|
|
|
}
|
|
|
|
}
|