42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
class AddForeignKeysToAbInvoiceItemTable extends Migration {
|
|
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::table('ab_invoice_item', function(Blueprint $table)
|
|
{
|
|
$table->foreign('invoice_id', 'fk_ii_inv')->references('id')->on('ab_invoice')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
$table->foreign('module_id', 'fk_ii_mod')->references('id')->on('ab_module')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
$table->foreign('product_id', 'fk_ii_pdt')->references('id')->on('ab_product')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
$table->foreign('service_id', 'fk_ii_svc')->references('id')->on('ab_service')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::table('ab_invoice_item', function(Blueprint $table)
|
|
{
|
|
$table->dropForeign('fk_ii_inv');
|
|
$table->dropForeign('fk_ii_mod');
|
|
$table->dropForeign('fk_ii_pdt');
|
|
$table->dropForeign('fk_ii_svc');
|
|
});
|
|
}
|
|
|
|
}
|