1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-17 16:42:48 +01:00

Fix for foreign keys

This commit is contained in:
Hillel Coren 2016-09-05 08:18:22 +03:00
parent 08590a4b6f
commit 548bb08b18
3 changed files with 22 additions and 8 deletions

View File

@ -49,6 +49,9 @@ class EnterprisePlan extends Migration
Schema::table('accounts', function($table)
{
$table->unsignedInteger('company_id')->nullable();
});
Schema::table('accounts', function($table)
{
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
});
}

View File

@ -41,7 +41,10 @@ class AddPageSize extends Migration
Schema::table('expenses', function ($table) {
$table->unsignedInteger('expense_category_id')->nullable()->index();
//$table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade');
});
Schema::table('expenses', function ($table) {
$table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade');
});
}
@ -63,7 +66,7 @@ class AddPageSize extends Migration
});
Schema::table('expenses', function ($table) {
//$table->dropForeign('expenses_expense_category_id_foreign');
$table->dropForeign('expenses_expense_category_id_foreign');
$table->dropColumn('expense_category_id');
});

View File

@ -79,18 +79,22 @@ class PaymentsChanges extends Migration
{
$table->decimal('refunded', 13, 2);
$table->unsignedInteger('payment_status_id')->default(PAYMENT_STATUS_COMPLETED);
$table->foreign('payment_status_id')->references('id')->on('payment_statuses');
$table->unsignedInteger('routing_number')->nullable();
$table->smallInteger('last4')->unsigned()->nullable();
$table->date('expiration')->nullable();
$table->text('gateway_error')->nullable();
$table->string('email')->nullable();
$table->unsignedInteger('payment_method_id')->nullable();
//$table->foreign('payment_method_id')->references('id')->on('payment_methods');
});
Schema::table('payments', function($table)
{
$table->foreign('payment_status_id')->references('id')->on('payment_statuses');
$table->foreign('payment_method_id')->references('id')->on('payment_methods');
});
Schema::table('invoices', function($table)
{
$table->boolean('client_enable_auto_bill')->default(false);
@ -109,7 +113,11 @@ class PaymentsChanges extends Migration
Schema::table('account_gateway_tokens', function($table)
{
$table->unsignedInteger('default_payment_method_id')->nullable();
//$table->foreign('default_payment_method_id')->references('id')->on('payment_methods');
});
Schema::table('account_gateway_tokens', function($table)
{
$table->foreign('default_payment_method_id')->references('id')->on('payment_methods');
});
}
@ -133,7 +141,7 @@ class PaymentsChanges extends Migration
$table->dropColumn('gateway_error');
$table->dropColumn('email');
//$table->dropForeign('payments_payment_method_id_foreign');
$table->dropForeign('payments_payment_method_id_foreign');
$table->dropColumn('payment_method_id');
});
@ -163,7 +171,7 @@ class PaymentsChanges extends Migration
Schema::table('account_gateway_tokens', function($table)
{
//$table->dropForeign('account_gateway_tokens_default_payment_method_id_foreign');
$table->dropForeign('account_gateway_tokens_default_payment_method_id_foreign');
$table->dropColumn('default_payment_method_id');
});