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

44 lines
1.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToAbAccountTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ab_account', function(Blueprint $table)
{
$table->foreign('country_id', 'fk_acc_cty')->references('id')->on('ab_country')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('currency_id', 'fk_acc_cur')->references('id')->on('ab_currency')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('language_id', 'fk_acc_lan')->references('id')->on('ab_language')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('rtm_id', 'fk_acc_rtm')->references('id')->on('ab_rtm')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('site_id', 'fk_acc_set')->references('id')->on('ab_setup')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ab_account', function(Blueprint $table)
{
$table->dropForeign('fk_acc_cty');
$table->dropForeign('fk_acc_cur');
$table->dropForeign('fk_acc_lan');
$table->dropForeign('fk_acc_rtm');
$table->dropForeign('fk_acc_set');
});
}
}