database/migrations/2020_01_09_212616_create_ifrs_currencies_table.php
<?php
/**
* Eloquent IFRS Accounting
*
* @author Edward Mungai
* @copyright Edward Mungai, 2020, Germany
* @license MIT
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateIfrsCurrenciesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
config('ifrs.table_prefix') . 'currencies',
function (Blueprint $table) {
$table->bigIncrements('id');
// relationships
$table->unsignedBigInteger('entity_id');
// constraints
$table->foreign('entity_id')->references('id')->on(config('ifrs.table_prefix') . 'entities');
// attributes
$table->string('name', 300);
$table->string('currency_code', 3);
// *permanent* deletion
$table->dateTime('destroyed_at')->nullable();
//soft deletion
$table->softDeletes();
$table->timestamps();
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists(config('ifrs.table_prefix') . 'currencies');
}
}