Fix migration from integer to string to handle polymorphic migration

This commit is contained in:
snipe 2016-09-20 00:46:14 -07:00
parent 3aa7c60765
commit 90af734f6b
2 changed files with 32 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class CreateActionlogTable extends Migration
$table->integer('user_id')->nullable();
$table->string('action_type');
$table->integer('target_id')->nullable(); // Was checkedout_to
$table->integer('target_type')->nullable(); // For polymorphic thingies
$table->string('target_type')->nullable(); // For polymorphic thingies
$table->integer('location_id')->nullable();
$table->text('note')->nullable();
$table->text('filename')->nullable();

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class FixFieldtypeForTargetType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('action_logs', function ($table) {
$table->string('target_type')->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('action_logs', function ($table) {
$table->integer('target_type')->nullable()->default(null)->change();
});
}
}