mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Now with the added capability of adding money to a piggy bank from a transfer. Also various fixes (see issue #6). [skip ci]
This commit is contained in:
@@ -11,6 +11,16 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
class CreateTransactionsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transactions');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -23,6 +33,7 @@ class CreateTransactionsTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('account_id')->unsigned();
|
||||
$table->integer('piggybank_id')->nullable()->unsigned();
|
||||
$table->integer('transaction_journal_id')->unsigned();
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->decimal('amount', 10, 2);
|
||||
@@ -32,6 +43,11 @@ class CreateTransactionsTable extends Migration
|
||||
->references('id')->on('transaction_journals')
|
||||
->onDelete('cascade');
|
||||
|
||||
// connect piggy banks
|
||||
$table->foreign('piggybank_id')
|
||||
->references('id')->on('piggybanks')
|
||||
->onDelete('set null');
|
||||
|
||||
// connect account id:
|
||||
$table->foreign('account_id')
|
||||
->references('id')->on('accounts')
|
||||
@@ -41,14 +57,4 @@ class CreateTransactionsTable extends Migration
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transactions');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,43 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreatePiggyInstance extends Migration {
|
||||
class CreatePiggyInstance extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('piggybank_repetitions', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('piggybank_id')->unsigned();
|
||||
$table->date('startdate')->nullable();
|
||||
$table->date('targetdate')->nullable();
|
||||
$table->decimal('currentamount',10,2);
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'piggybank_repetitions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('piggybank_id')->unsigned();
|
||||
$table->date('startdate')->nullable();
|
||||
$table->date('targetdate')->nullable();
|
||||
$table->decimal('currentamount', 10, 2);
|
||||
|
||||
$table->unique(['piggybank_id','startdate','targetdate']);
|
||||
$table->unique(['piggybank_id', 'startdate', 'targetdate']);
|
||||
|
||||
// connect instance to piggybank.
|
||||
$table->foreign('piggybank_id')
|
||||
->references('id')->on('piggybanks')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// 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_repetitions');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('piggybank_repetitions');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user