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

42 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToAbSetupTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ab_setup', function(Blueprint $table)
{
$table->foreign('admin_id', 'fk_set_acc')->references('id')->on('ab_account')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('country_id', 'fk_set_cty')->references('id')->on('ab_country')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('currency_id', 'fk_set_cur')->references('id')->on('ab_currency')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('language_id', 'fk_set_lan')->references('id')->on('ab_language')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ab_setup', function(Blueprint $table)
{
$table->dropForeign('fk_set_acc');
$table->dropForeign('fk_set_cty');
$table->dropForeign('fk_set_cur');
$table->dropForeign('fk_set_lan');
});
}
}