mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-09-01 02:34:13 +00:00
create migration for invoices, details and statuse
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsToInvoice extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->string('buyer_company', 50);
|
||||
$table->string('reg_no', 100);
|
||||
$table->string('address', 120);
|
||||
$table->string('contact_no', 20);
|
||||
$table->string('po_number', 20);
|
||||
$table->string('order_no', 20);
|
||||
$table->double('tax_rate')->default(0);
|
||||
$table->double('billing_charge_rate');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddInvoiceDetails extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_details', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order');
|
||||
$table->string('description');
|
||||
$table->integer('quantity');
|
||||
$table->double('unit_price');
|
||||
$table->string('stock_code');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_details');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddForeignIdToInvoiceDetails extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('invoice_details', function (Blueprint $table) {
|
||||
$table->integer('invoice_id')->unsigned();
|
||||
|
||||
$table->foreign('invoice_id')
|
||||
->references('id')
|
||||
->on('invoices')
|
||||
->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoice_details', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoiceStatus extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_statuses', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('status', 20);
|
||||
$table->string('comment');
|
||||
$table->timestamps();
|
||||
$table->integer('invoice_id')->unsigned();
|
||||
$table->foreign('invoice_id')
|
||||
->references('id')
|
||||
->on('invoices')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_statuses');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user