osb/database/migrations/2017_06_18_104531_create_ab_invoice_item_table.php
2018-06-18 21:18:34 +10:00

56 lines
1.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAbInvoiceItemTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ab_invoice_item', function(Blueprint $table)
{
$table->bigInteger('id');
$table->integer('site_id');
$table->bigInteger('date_orig')->nullable();
$table->bigInteger('date_last')->nullable();
$table->bigInteger('service_id')->nullable();
$table->bigInteger('invoice_id');
$table->boolean('active')->nullable();
$table->bigInteger('product_id')->nullable();
$table->integer('module_id')->nullable();
$table->bigInteger('module_ref')->nullable();
$table->float('quantity', 10, 0)->nullable();
$table->boolean('item_type')->nullable();
$table->string('product_name', 128)->nullable();
$table->float('discount_amt', 10, 0)->nullable();
$table->float('price_base', 10, 0)->nullable();
$table->integer('recurring_schedule')->nullable();
$table->bigInteger('date_start')->nullable();
$table->bigInteger('date_stop')->nullable();
$table->primary(['id','site_id','invoice_id']);
$table->unique(['id','site_id'], 'UNIQUE');
$table->index(['invoice_id','site_id'], 'fk_ii_inv_idx');
$table->index(['product_id','site_id'], 'fk_ii_pdt_idx');
$table->index(['service_id','site_id'], 'fk_ii_svc_idx');
$table->index(['module_id','site_id'], 'fk_ii_mod_idx');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ab_invoice_item');
}
}