Fixes for initial setup

This commit is contained in:
Hillel Coren 2016-05-12 20:27:24 +03:00
parent 3202d2480f
commit 6c4009d1ef
7 changed files with 121 additions and 105 deletions

View File

@ -325,8 +325,8 @@ class ConfideSetupUsersTable extends Migration {
$t->timestamp('last_sent_date')->nullable(); $t->timestamp('last_sent_date')->nullable();
$t->unsignedInteger('recurring_invoice_id')->index()->nullable(); $t->unsignedInteger('recurring_invoice_id')->index()->nullable();
$t->string('tax_name'); $t->string('tax_name1');
$t->decimal('tax_rate', 13, 2); $t->decimal('tax_rate1', 13, 3);
$t->decimal('amount', 13, 2); $t->decimal('amount', 13, 2);
$t->decimal('balance', 13, 2); $t->decimal('balance', 13, 2);
@ -375,7 +375,7 @@ class ConfideSetupUsersTable extends Migration {
$t->softDeletes(); $t->softDeletes();
$t->string('name'); $t->string('name');
$t->decimal('rate', 13, 2); $t->decimal('rate', 13, 3);
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');; $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
@ -420,8 +420,8 @@ class ConfideSetupUsersTable extends Migration {
$t->decimal('cost', 13, 2); $t->decimal('cost', 13, 2);
$t->decimal('qty', 13, 2)->nullable(); $t->decimal('qty', 13, 2)->nullable();
$t->string('tax_name')->nullable(); $t->string('tax_name1')->nullable();
$t->decimal('tax_rate', 13, 2)->nullable(); $t->decimal('tax_rate1', 13, 3)->nullable();
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); $t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
$t->foreign('product_id')->references('id')->on('products')->onDelete('cascade'); $t->foreign('product_id')->references('id')->on('products')->onDelete('cascade');

View File

@ -79,7 +79,7 @@ class CreateVendorsTable extends Migration
$table->date('expense_date')->nullable(); $table->date('expense_date')->nullable();
$table->text('private_notes'); $table->text('private_notes');
$table->text('public_notes'); $table->text('public_notes');
$table->unsignedInteger('currency_id')->nullable(); $table->unsignedInteger('invoice_currency_id')->nullable(false);
$table->boolean('should_be_invoiced')->default(true); $table->boolean('should_be_invoiced')->default(true);
// Relations // Relations

View File

@ -35,13 +35,13 @@ class AddBankSubaccounts extends Migration {
Schema::table('expenses', function($table) Schema::table('expenses', function($table)
{ {
$table->string('transaction_id'); $table->string('transaction_id')->nullable();
$table->unsignedInteger('bank_id'); $table->unsignedInteger('bank_id')->nullable();
}); });
Schema::table('vendors', function($table) Schema::table('vendors', function($table)
{ {
$table->string('transaction_name'); $table->string('transaction_name')->nullable();
}); });
} }

View File

@ -28,13 +28,17 @@ class AddHeaderFooterOption extends Migration {
Schema::table('expenses', function($table) Schema::table('expenses', function($table)
{ {
$table->string('transaction_id')->nullable()->change(); if (Schema::hasColumn('expenses', 'transaction_id')) {
$table->unsignedInteger('bank_id')->nullable()->change(); $table->string('transaction_id')->nullable()->change();
$table->unsignedInteger('bank_id')->nullable()->change();
}
}); });
Schema::table('vendors', function($table) Schema::table('vendors', function($table)
{ {
$table->string('transaction_name')->nullable()->change(); if (Schema::hasColumn('vendors', 'transaction_name')) {
$table->string('transaction_name')->nullable()->change();
}
}); });
} }

View File

@ -16,10 +16,12 @@ class AddSourceCurrencyToExpenses extends Migration
$table->dropColumn('foreign_amount'); $table->dropColumn('foreign_amount');
$table->unsignedInteger('currency_id')->nullable(false)->change(); if (Schema::hasColumn('expenses', 'currency_id')) {
$table->renameColumn('currency_id', 'invoice_currency_id'); $table->unsignedInteger('currency_id')->nullable(false)->change();
$table->unsignedInteger('expense_currency_id'); $table->renameColumn('currency_id', 'invoice_currency_id');
}
$table->unsignedInteger('expense_currency_id');
}); });
Schema::table('expenses', function (Blueprint $table) { Schema::table('expenses', function (Blueprint $table) {

View File

@ -11,7 +11,9 @@ class AddSupportThreeDecimalTaxes extends Migration {
public function up() public function up()
{ {
Schema::table('tax_rates', function($table) { Schema::table('tax_rates', function($table) {
$table->decimal('rate', 13, 3)->change(); if (Schema::hasColumn('tax_rates', 'rate')) {
$table->decimal('rate', 13, 3)->change();
}
}); });
} }
/** /**

View File

@ -13,30 +13,38 @@ class SupportMultipleTaxRates extends Migration
public function up() public function up()
{ {
Schema::table('invoices', function($table) { Schema::table('invoices', function($table) {
$table->decimal('tax_rate', 13, 3)->change(); if (Schema::hasColumn('invoices', 'tax_rate')) {
}); $table->decimal('tax_rate', 13, 3)->change();
}
});
Schema::table('invoice_items', function($table) { Schema::table('invoice_items', function($table) {
$table->decimal('tax_rate', 13, 3)->change(); if (Schema::hasColumn('invoice_items', 'tax_rate')) {
}); $table->decimal('tax_rate', 13, 3)->change();
}
});
Schema::table('invoices', function($table) { Schema::table('invoices', function($table) {
if (Schema::hasColumn('invoices', 'tax_rate')) {
$table->renameColumn('tax_rate', 'tax_rate1'); $table->renameColumn('tax_rate', 'tax_rate1');
$table->renameColumn('tax_name', 'tax_name1'); $table->renameColumn('tax_name', 'tax_name1');
$table->string('tax_name2')->nullable(); }
$table->decimal('tax_rate2', 13, 3); $table->string('tax_name2')->nullable();
$table->decimal('tax_rate2', 13, 3);
}); });
Schema::table('invoice_items', function($table) { Schema::table('invoice_items', function($table) {
if (Schema::hasColumn('invoice_items', 'tax_rate')) {
$table->renameColumn('tax_rate', 'tax_rate1'); $table->renameColumn('tax_rate', 'tax_rate1');
$table->renameColumn('tax_name', 'tax_name1'); $table->renameColumn('tax_name', 'tax_name1');
$table->string('tax_name2')->nullable(); }
$table->decimal('tax_rate2', 13, 3); $table->string('tax_name2')->nullable();
$table->decimal('tax_rate2', 13, 3);
}); });
Schema::table('accounts', function($table) { Schema::table('accounts', function($table) {
$table->boolean('enable_client_portal_dashboard')->default(true); $table->boolean('enable_client_portal_dashboard')->default(true);
}); });
} }
/** /**
* Reverse the migrations. * Reverse the migrations.