From 7b5af7e2b80960d1e35b6ad1ed952fe29b5f580c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 18 Dec 2016 21:29:50 +0200 Subject: [PATCH] Fix for migration --- ...016_11_03_113316_add_invoice_signature.php | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/database/migrations/2016_11_03_113316_add_invoice_signature.php b/database/migrations/2016_11_03_113316_add_invoice_signature.php index 5a567dcf1129..34e42552741e 100644 --- a/database/migrations/2016_11_03_113316_add_invoice_signature.php +++ b/database/migrations/2016_11_03_113316_add_invoice_signature.php @@ -12,40 +12,44 @@ class AddInvoiceSignature extends Migration */ public function up() { - Schema::table('invitations', function($table) + if ( ! Schema::hasColumn('invitations', 'signature_base64')) { - $table->text('signature_base64')->nullable(); - $table->timestamp('signature_date')->nullable(); - }); + Schema::table('invitations', function($table) + { + $table->text('signature_base64')->nullable(); + $table->timestamp('signature_date')->nullable(); + }); - Schema::table('companies', function($table) - { - $table->string('utm_source')->nullable(); - $table->string('utm_medium')->nullable(); - $table->string('utm_campaign')->nullable(); - $table->string('utm_term')->nullable(); - $table->string('utm_content')->nullable(); - }); + Schema::table('companies', function($table) + { + $table->string('utm_source')->nullable(); + $table->string('utm_medium')->nullable(); + $table->string('utm_campaign')->nullable(); + $table->string('utm_term')->nullable(); + $table->string('utm_content')->nullable(); + }); - Schema::table('payment_methods', function($table) - { - $table->dropForeign('payment_methods_account_gateway_token_id_foreign'); - }); + Schema::table('payment_methods', function($table) + { + $table->unsignedInteger('account_gateway_token_id')->nullable()->change(); + $table->dropForeign('payment_methods_account_gateway_token_id_foreign'); + }); - Schema::table('payment_methods', function($table) - { - $table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens')->onDelete('cascade'); - }); + Schema::table('payment_methods', function($table) + { + $table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens')->onDelete('cascade'); + }); - Schema::table('payments', function($table) - { - $table->dropForeign('payments_payment_method_id_foreign'); - }); + Schema::table('payments', function($table) + { + $table->dropForeign('payments_payment_method_id_foreign'); + }); - Schema::table('payments', function($table) - { - $table->foreign('payment_method_id')->references('id')->on('payment_methods')->onDelete('cascade');; - }); + Schema::table('payments', function($table) + { + $table->foreign('payment_method_id')->references('id')->on('payment_methods')->onDelete('cascade');; + }); + } } /**