Files
crater/database/migrations/2017_04_12_090759_create_invoices_table.php
Mohit Panjwani bdf2ba51d6 init crater
2019-11-11 12:16:00 +05:30

57 lines
1.9 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->increments('id');
$table->date('invoice_date');
$table->date('due_date');
$table->string('invoice_number');
$table->string('reference_number')->nullable();
$table->string('status');
$table->string('paid_status');
$table->string('tax_per_item');
$table->string('discount_per_item');
$table->text('notes')->nullable();
$table->decimal('discount', 15, 0)->nullable();
$table->string('discount_type')->nullable();
$table->integer('discount_val')->nullable();
$table->integer('sub_total');
$table->integer('total');
$table->integer('tax');
$table->integer('due_amount');
$table->boolean('sent')->default(false);
$table->boolean('viewed')->default(false);
$table->string('unique_hash')->nullable();
$table->integer('invoice_template_id')->unsigned()->nullable();
$table->foreign('invoice_template_id')->references('id')->on('invoice_templates');
$table->integer('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$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('invoices');
}
}