You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2023_09_08_011045_create_taxes_table.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use App\Enums\Setting\TaxComputation;
  3. use App\Enums\Setting\TaxType;
  4. use Illuminate\Database\Migrations\Migration;
  5. use Illuminate\Database\Schema\Blueprint;
  6. use Illuminate\Support\Facades\Schema;
  7. return new class extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. */
  12. public function up(): void
  13. {
  14. Schema::create('taxes', function (Blueprint $table) {
  15. $table->id();
  16. $table->foreignId('company_id')->constrained()->cascadeOnDelete();
  17. $table->string('name')->index();
  18. $table->string('description')->nullable();
  19. $table->integer('rate')->default(0);
  20. $table->string('computation')->default(TaxComputation::DEFAULT);
  21. $table->string('type')->default(TaxType::DEFAULT);
  22. $table->string('scope')->nullable();
  23. $table->boolean('enabled')->default(true);
  24. $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
  25. $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
  26. $table->timestamps();
  27. $table->unique(['company_id', 'name', 'type']);
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. */
  33. public function down(): void
  34. {
  35. Schema::dropIfExists('taxes');
  36. }
  37. };