Fixes for initial setup

This commit is contained in:
Hillel Coren 2016-05-24 10:17:03 +03:00
parent 15cf367104
commit 0b643b4741
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->unsignedInteger('recurring_invoice_id')->index()->nullable();
$t->string('tax_name');
$t->decimal('tax_rate', 13, 2);
$t->string('tax_name1');
$t->decimal('tax_rate1', 13, 3);
$t->decimal('amount', 13, 2);
$t->decimal('balance', 13, 2);
@ -375,7 +375,7 @@ class ConfideSetupUsersTable extends Migration {
$t->softDeletes();
$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('user_id')->references('id')->on('users')->onDelete('cascade');;
@ -420,8 +420,8 @@ class ConfideSetupUsersTable extends Migration {
$t->decimal('cost', 13, 2);
$t->decimal('qty', 13, 2)->nullable();
$t->string('tax_name')->nullable();
$t->decimal('tax_rate', 13, 2)->nullable();
$t->string('tax_name1')->nullable();
$t->decimal('tax_rate1', 13, 3)->nullable();
$t->foreign('invoice_id')->references('id')->on('invoices')->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->text('private_notes');
$table->text('public_notes');
$table->unsignedInteger('currency_id')->nullable();
$table->unsignedInteger('invoice_currency_id')->nullable(false);
$table->boolean('should_be_invoiced')->default(true);
// Relations

View File

@ -35,13 +35,13 @@ class AddBankSubaccounts extends Migration {
Schema::table('expenses', function($table)
{
$table->string('transaction_id');
$table->unsignedInteger('bank_id');
$table->string('transaction_id')->nullable();
$table->unsignedInteger('bank_id')->nullable();
});
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)
{
if (Schema::hasColumn('expenses', 'transaction_id')) {
$table->string('transaction_id')->nullable()->change();
$table->unsignedInteger('bank_id')->nullable()->change();
}
});
Schema::table('vendors', function($table)
{
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');
if (Schema::hasColumn('expenses', 'currency_id')) {
$table->unsignedInteger('currency_id')->nullable(false)->change();
$table->renameColumn('currency_id', 'invoice_currency_id');
$table->unsignedInteger('expense_currency_id');
}
$table->unsignedInteger('expense_currency_id');
});
Schema::table('expenses', function (Blueprint $table) {

View File

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

View File

@ -13,23 +13,31 @@ class SupportMultipleTaxRates extends Migration
public function up()
{
Schema::table('invoices', function($table) {
if (Schema::hasColumn('invoices', 'tax_rate')) {
$table->decimal('tax_rate', 13, 3)->change();
}
});
Schema::table('invoice_items', function($table) {
if (Schema::hasColumn('invoice_items', 'tax_rate')) {
$table->decimal('tax_rate', 13, 3)->change();
}
});
Schema::table('invoices', function($table) {
if (Schema::hasColumn('invoices', 'tax_rate')) {
$table->renameColumn('tax_rate', 'tax_rate1');
$table->renameColumn('tax_name', 'tax_name1');
}
$table->string('tax_name2')->nullable();
$table->decimal('tax_rate2', 13, 3);
});
Schema::table('invoice_items', function($table) {
if (Schema::hasColumn('invoice_items', 'tax_rate')) {
$table->renameColumn('tax_rate', 'tax_rate1');
$table->renameColumn('tax_name', 'tax_name1');
}
$table->string('tax_name2')->nullable();
$table->decimal('tax_rate2', 13, 3);
});