feat: add legacy PDF generation support and invoice discount fields
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('invoices', 'discount_rate')) {
|
||||
$table->integer('discount_rate')->default(0);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('invoice_items', 'is_discountable')) {
|
||||
$table->boolean('is_discountable')->default(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('invoices', 'discount_rate')) {
|
||||
$table->dropColumn('discount_rate');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('invoice_items', 'is_discountable')) {
|
||||
$table->dropColumn('is_discountable');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user