Skip to content

Commit

Permalink
Merge pull request #17 from emilv/master
Browse files Browse the repository at this point in the history
Change type of versionable_id and versionable_type, index versionable_id
  • Loading branch information
mpociot authored Jul 18, 2016
2 parents 8254fdb + a30f0f4 commit eee7b9b
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeVersionableIdAndTypeFields extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('versions', function(Blueprint $table)
{
$table->integer('versionable_id')->unsigned()->change();
$table->string('versionable_type')->change();
$table->index('versionable_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('versions', function(Blueprint $table)
{
$table->integer('versionable_id')->change();
$table->text('versionable_type')->change();
$table->dropIndex('versions_versionable_id_index');
});
}

}

0 comments on commit eee7b9b

Please sign in to comment.