mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Support\Facades\Schema;
 | |
| use Illuminate\Database\Schema\Blueprint;
 | |
| use Illuminate\Database\Migrations\Migration;
 | |
| 
 | |
| class CreateEstimatesTable extends Migration
 | |
| {
 | |
|     /**
 | |
|      * Run the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function up()
 | |
|     {
 | |
|         Schema::create('estimates', function (Blueprint $table) {
 | |
|             $table->increments('id');
 | |
|             $table->date('estimate_date');
 | |
|             $table->date('expiry_date');
 | |
|             $table->string('estimate_number');
 | |
|             $table->string('status');
 | |
|             $table->string('reference_number')->nullable();
 | |
|             $table->string('tax_per_item');
 | |
|             $table->string('discount_per_item');
 | |
|             $table->string('notes')->nullable();
 | |
|             $table->string('discount_type')->nullable();
 | |
|             $table->unsignedBigInteger('discount')->nullable();
 | |
|             $table->unsignedBigInteger('discount_val')->nullable();
 | |
|             $table->unsignedBigInteger('sub_total');
 | |
|             $table->unsignedBigInteger('total');
 | |
|             $table->unsignedBigInteger('tax');
 | |
|             $table->string('unique_hash')->nullable();
 | |
|             $table->integer('user_id')->unsigned()->nullable();
 | |
|             $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
 | |
|             $table->integer('estimate_template_id')->unsigned()->nullable();
 | |
|             $table->foreign('estimate_template_id')->references('id')->on('estimate_templates');
 | |
|             $table->integer('company_id')->unsigned()->nullable();
 | |
|             $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
 | |
|             $table->timestamps();
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function down()
 | |
|     {
 | |
|         Schema::dropIfExists('estimates');
 | |
|     }
 | |
| }
 |