mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 13:11:08 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Support\Facades\Schema;
 | |
| use Illuminate\Database\Schema\Blueprint;
 | |
| use Illuminate\Database\Migrations\Migration;
 | |
| 
 | |
| class CreateTaxesTable extends Migration
 | |
| {
 | |
|     /**
 | |
|      * Run the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function up()
 | |
|     {
 | |
|         Schema::create('taxes', function (Blueprint $table) {
 | |
|             $table->increments('id');
 | |
|             $table->integer('tax_type_id')->unsigned();
 | |
|             $table->foreign('tax_type_id')->references('id')->on('tax_types');
 | |
|             $table->integer('invoice_id')->unsigned()->nullable();
 | |
|             $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
 | |
|             $table->integer('estimate_id')->unsigned()->nullable();
 | |
|             $table->foreign('estimate_id')->references('id')->on('estimates')->onDelete('cascade');
 | |
|             $table->integer('invoice_item_id')->unsigned()->nullable();
 | |
|             $table->foreign('invoice_item_id')->references('id')->on('invoice_items')->onDelete('cascade');
 | |
|             $table->integer('estimate_item_id')->unsigned()->nullable();
 | |
|             $table->foreign('estimate_item_id')->references('id')->on('estimate_items')->onDelete('cascade');
 | |
|             $table->integer('item_id')->unsigned()->nullable();
 | |
|             $table->foreign('item_id')->references('id')->on('items')->onDelete('cascade');
 | |
|             $table->integer('company_id')->unsigned()->nullable();
 | |
|             $table->foreign('company_id')->references('id')->on('companies');
 | |
|             $table->string('name');
 | |
|             $table->decimal('amount', 15, 0);
 | |
|             $table->decimal('percent', 5, 2);
 | |
|             $table->tinyInteger('compound_tax')->default(0);
 | |
|             $table->timestamps();
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function down()
 | |
|     {
 | |
|         Schema::dropIfExists('taxes');
 | |
|     }
 | |
| }
 |