invoiceninja/database/migrations/2021_01_05_013203_improve_decimal_resolution.php
Shift 19080933b6
Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions.

You may customize the code style applied by adding a [PHP CS Fixer][1] or [PHP CodeSniffer][2] ruleset to your project root. Feel free to use [Shift's Laravel ruleset][3] to help you get started.

For more information on customizing the code style applied by Shift, [watch this short video][4].

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://github.com/squizlabs/PHP_CodeSniffer
[3]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
[4]: https://laravelshift.com/videos/shift-code-style
2022-06-21 09:57:17 +00:00

160 lines
6.1 KiB
PHP

<?php
use App\Models\Task;
use App\Models\TaskStatus;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ImproveDecimalResolution extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('company_ledgers', function (Blueprint $table) {
$table->decimal('balance', 20, 6)->change();
$table->decimal('adjustment', 20, 6)->change();
});
Schema::table('credits', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('total_taxes', 20, 6)->change();
$table->decimal('exchange_rate', 20, 6)->change();
$table->decimal('balance', 20, 6)->change();
$table->decimal('partial', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
});
Schema::table('invoices', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('total_taxes', 20, 6)->change();
$table->decimal('exchange_rate', 20, 6)->change();
$table->decimal('balance', 20, 6)->change();
$table->decimal('partial', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
});
Schema::table('quotes', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('total_taxes', 20, 6)->change();
$table->decimal('exchange_rate', 20, 6)->change();
$table->decimal('balance', 20, 6)->change();
$table->decimal('partial', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
});
Schema::table('expenses', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
$table->decimal('foreign_amount', 20, 6)->change();
$table->decimal('exchange_rate', 20, 6)->change();
});
Schema::table('payments', function (Blueprint $table) {
$table->decimal('amount', 20, 6)->change();
$table->decimal('refunded', 20, 6)->change();
$table->decimal('applied', 20, 6)->change();
$table->decimal('exchange_rate', 20, 6)->change();
});
Schema::table('products', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
});
Schema::table('projects', function (Blueprint $table) {
$table->decimal('task_rate', 20, 6)->change();
$table->decimal('budgeted_hours', 20, 6)->change();
});
Schema::table('recurring_invoices', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('total_taxes', 20, 6)->change();
$table->decimal('balance', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
});
Schema::table('recurring_quotes', function (Blueprint $table) {
$table->decimal('tax_rate1', 20, 6)->change();
$table->decimal('tax_rate2', 20, 6)->change();
$table->decimal('tax_rate3', 20, 6)->change();
$table->decimal('total_taxes', 20, 6)->change();
$table->decimal('balance', 20, 6)->change();
$table->decimal('amount', 20, 6)->change();
});
Schema::table('clients', function (Blueprint $table) {
$table->decimal('balance', 20, 6)->change();
$table->decimal('paid_to_date', 20, 6)->change();
$table->decimal('credit_balance', 20, 6)->change();
});
Schema::table('tasks', function (Blueprint $table) {
$table->decimal('rate', 20, 6)->change();
$table->integer('status_sort_order')->nullable()->default(null)->change();
});
Schema::table('task_statuses', function (Blueprint $table) {
$table->string('color')->default('#fff');
$table->integer('status_sort_order')->nullable()->default(null)->change();
});
Schema::table('tax_rates', function (Blueprint $table) {
$table->decimal('rate', 20, 6)->change();
});
Schema::table('companies', function (Blueprint $table) {
$table->boolean('calculate_expense_tax_by_amount')->false();
$table->boolean('hide_empty_columns_on_pdf')->false();
});
Schema::table('expense_categories', function (Blueprint $table) {
$table->string('color')->default('#fff');
});
Schema::table('projects', function (Blueprint $table) {
$table->string('color')->default('#fff');
});
Task::query()->update(['status_sort_order' => null]);
TaskStatus::query()->update(['status_sort_order' => null]);
Schema::table('tasks', function (Blueprint $table) {
$table->integer('status_order')->nullable();
});
Schema::table('task_statuses', function (Blueprint $table) {
$table->integer('status_order')->nullable();
});
Schema::table('companies', function (Blueprint $table) {
$table->dropColumn('hide_empty_columns_on_pdf');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}