1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00
invoiceninja/database/migrations/2022_07_28_232340_enabled_expense_tax_rates_to_companies_table.php
2023-02-16 12:36:09 +11:00

35 lines
768 B
PHP

<?php
use App\Models\Company;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->boolean('enabled_expense_tax_rates')->default(0);
});
Company::query()->where('enabled_item_tax_rates', true)->cursor()->each(function ($company) {
$company->enabled_expense_tax_rates = true;
$company->save();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};