diff --git a/migrations/2018_09_04_161009_add_parent_id_to_table.php b/migrations/2018_09_04_161009_add_parent_id_to_table.php index 0b7a666..9c7b966 100644 --- a/migrations/2018_09_04_161009_add_parent_id_to_table.php +++ b/migrations/2018_09_04_161009_add_parent_id_to_table.php @@ -14,11 +14,16 @@ class AddParentIdToTable extends Migration public function up() { Schema::table(config('process-stamps.table'), function (Blueprint $table) { - $table->unsignedInteger('parent_id')->nullable()->index()->after('hash'); - $table->foreign('parent_id') - ->references(config('process-stamps.columns.primary_key')) - ->on(config('process-stamps.table')); + // In v1.1.2 we changed the timestamp of this migration. + // This check prevents issues if someone already migrated with the old timestamp. + if (! Schema::hasColumn(config('process-stamps.table'), 'parent_id')) { + $table->unsignedInteger('parent_id')->nullable()->index()->after('hash'); + + $table->foreign('parent_id') + ->references(config('process-stamps.columns.primary_key')) + ->on(config('process-stamps.table')); + } }); }