Added IO_type migration.
Changed person_targets migration to use a foreign key to the io_types table instead of an enum.
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IOType extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -31,7 +31,9 @@ class CreatePersonTargetsTable extends Migration
|
|||||||
// The type of the target. It can be either a payable or a
|
// The type of the target. It can be either a payable or a
|
||||||
// receivable. A payable is of type 'expediture' and a receivable is
|
// receivable. A payable is of type 'expediture' and a receivable is
|
||||||
// of type 'income'.
|
// of type 'income'.
|
||||||
$table->tinyInteger('io_type');
|
$table->integer('io_type')->unsigned();
|
||||||
|
$table->foreign('io_type')->references('id')->on('io_types')
|
||||||
|
->onDelete('no action');
|
||||||
|
|
||||||
// A reference text which describes the target
|
// A reference text which describes the target
|
||||||
$table->string('reference');
|
$table->string('reference');
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateIOTypesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('io_types', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
|
||||||
|
$table->string('type')
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('io_types');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user