Some changes to facilitate piggy bank events (see issue #6) and extra view info for clarity. [skip ci]

This commit is contained in:
James Cole
2014-08-18 12:28:33 +02:00
parent 5ac790433b
commit 87bddce1d3
7 changed files with 187 additions and 48 deletions

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePiggyEvents extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('piggybank_events', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->integer('piggybank_id')->unsigned();
$table->date('date');
$table->decimal('amount', 10, 2);
// connect instance to piggybank.
$table->foreign('piggybank_id')
->references('id')->on('piggybanks')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('piggybank_events');
}
}