Fix for migration

This commit is contained in:
Hillel Coren 2016-12-18 21:29:32 +02:00
parent cfe35723ea
commit ea6fdeefa8

View File

@ -12,40 +12,44 @@ class AddInvoiceSignature extends Migration
*/ */
public function up() public function up()
{ {
Schema::table('invitations', function($table) if ( ! Schema::hasColumn('invitations', 'signature_base64'))
{ {
$table->text('signature_base64')->nullable(); Schema::table('invitations', function($table)
$table->timestamp('signature_date')->nullable(); {
}); $table->text('signature_base64')->nullable();
$table->timestamp('signature_date')->nullable();
});
Schema::table('companies', function($table) Schema::table('companies', function($table)
{ {
$table->string('utm_source')->nullable(); $table->string('utm_source')->nullable();
$table->string('utm_medium')->nullable(); $table->string('utm_medium')->nullable();
$table->string('utm_campaign')->nullable(); $table->string('utm_campaign')->nullable();
$table->string('utm_term')->nullable(); $table->string('utm_term')->nullable();
$table->string('utm_content')->nullable(); $table->string('utm_content')->nullable();
}); });
Schema::table('payment_methods', function($table) Schema::table('payment_methods', function($table)
{ {
$table->dropForeign('payment_methods_account_gateway_token_id_foreign'); $table->unsignedInteger('account_gateway_token_id')->nullable()->change();
}); $table->dropForeign('payment_methods_account_gateway_token_id_foreign');
});
Schema::table('payment_methods', function($table) Schema::table('payment_methods', function($table)
{ {
$table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens')->onDelete('cascade'); $table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens')->onDelete('cascade');
}); });
Schema::table('payments', function($table) Schema::table('payments', function($table)
{ {
$table->dropForeign('payments_payment_method_id_foreign'); $table->dropForeign('payments_payment_method_id_foreign');
}); });
Schema::table('payments', function($table) Schema::table('payments', function($table)
{ {
$table->foreign('payment_method_id')->references('id')->on('payment_methods')->onDelete('cascade');; $table->foreign('payment_method_id')->references('id')->on('payment_methods')->onDelete('cascade');;
}); });
}
} }
/** /**