mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Even more code cleanup.
This commit is contained in:
parent
80c1184eac
commit
41562f8f6d
@ -1,44 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateUsersTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateUsersTable extends Migration {
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('email',100);
|
||||
$table->string('password',60);
|
||||
$table->string('reset',32)->nullable();
|
||||
$table->string('remember_token',255)->nullable();
|
||||
$table->boolean('migrated');
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('email', 100);
|
||||
$table->string('password', 60);
|
||||
$table->string('reset', 32)->nullable();
|
||||
$table->string('remember_token', 255)->nullable();
|
||||
$table->boolean('migrated');
|
||||
|
||||
$table->unique('email');
|
||||
});
|
||||
}
|
||||
$table->unique('email');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,53 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateAccountsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateAccountsTable extends Migration {
|
||||
class CreateAccountsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('accounts', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->integer('account_type_id')->unsigned();
|
||||
$table->string('name',100);
|
||||
$table->boolean('active');
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'accounts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->integer('account_type_id')->unsigned();
|
||||
$table->string('name', 100);
|
||||
$table->boolean('active');
|
||||
|
||||
// connect accounts to users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
// connect accounts to users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
// connect accounts to account_types
|
||||
$table->foreign('account_type_id')
|
||||
->references('id')->on('account_types')
|
||||
->onDelete('cascade');
|
||||
// connect accounts to account_types
|
||||
$table->foreign('account_type_id')
|
||||
->references('id')->on('account_types')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','account_type_id','name']);
|
||||
});
|
||||
}
|
||||
$table->unique(['user_id', 'account_type_id', 'name']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('accounts');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('accounts');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,48 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentsTable extends Migration {
|
||||
class CreateComponentsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('components', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('name',50);
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('class',20);
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'components', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('name', 50);
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('class', 20);
|
||||
|
||||
// connect components to users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
// connect components to users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','class','name']);
|
||||
});
|
||||
$table->unique(['user_id', 'class', 'name']);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('components');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('components');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,38 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionCurrenciesTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionCurrenciesTable extends Migration {
|
||||
class CreateTransactionCurrenciesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_currencies', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('code',3);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('code', 3);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_currencies');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_currencies');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,38 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionTypesTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionTypesTable extends Migration {
|
||||
class CreateTransactionTypesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_types', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('type',50);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_types', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('type', 50);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_types');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_types');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,58 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionJournalsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionJournalsTable extends Migration {
|
||||
class CreateTransactionJournalsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_journals', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->integer('transaction_type_id')->unsigned();
|
||||
$table->integer('transaction_currency_id')->unsigned();
|
||||
$table->string('description',255)->nullable();
|
||||
$table->boolean('completed');
|
||||
$table->date('date');
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_journals', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->integer('transaction_type_id')->unsigned();
|
||||
$table->integer('transaction_currency_id')->unsigned();
|
||||
$table->string('description', 255)->nullable();
|
||||
$table->boolean('completed');
|
||||
$table->date('date');
|
||||
|
||||
// connect transaction journals to transaction types
|
||||
$table->foreign('transaction_type_id')
|
||||
->references('id')->on('transaction_types')
|
||||
->onDelete('cascade');
|
||||
// connect transaction journals to transaction types
|
||||
$table->foreign('transaction_type_id')
|
||||
->references('id')->on('transaction_types')
|
||||
->onDelete('cascade');
|
||||
|
||||
// connect transaction journals to transaction currencies
|
||||
$table->foreign('transaction_currency_id')
|
||||
->references('id')->on('transaction_currencies')
|
||||
->onDelete('cascade');
|
||||
// connect transaction journals to transaction currencies
|
||||
$table->foreign('transaction_currency_id')
|
||||
->references('id')->on('transaction_currencies')
|
||||
->onDelete('cascade');
|
||||
|
||||
// connect users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// connect users
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_journals');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('transaction_journals');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,48 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentTransactionTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentTransactionTable extends Migration {
|
||||
class CreateComponentTransactionTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_transaction', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_id')->unsigned();
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'component_transaction', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_id')->unsigned();
|
||||
|
||||
// connect to components
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
// connect to components
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
|
||||
// connect to transactions
|
||||
$table->foreign('transaction_id')
|
||||
->references('id')->on('transactions')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// connect to transactions
|
||||
$table->foreign('transaction_id')
|
||||
->references('id')->on('transactions')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_transaction');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_transaction');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class CreatePiggybanksTable extends Migration
|
||||
$table->foreign('account_id')
|
||||
->references('id')->on('accounts')
|
||||
->onDelete('cascade');
|
||||
$table->unique(['account_id','name']);
|
||||
$table->unique(['account_id', 'name']);
|
||||
|
||||
}
|
||||
);
|
||||
|
@ -1,52 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateRecurringTransactionsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateRecurringTransactionsTable extends Migration {
|
||||
class CreateRecurringTransactionsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('recurring_transactions', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('name',50);
|
||||
$table->string('match',255);
|
||||
$table->decimal('amount_max',10,2);
|
||||
$table->decimal('amount_min',10,2);
|
||||
$table->date('date');
|
||||
$table->boolean('active');
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'recurring_transactions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('name', 50);
|
||||
$table->string('match', 255);
|
||||
$table->decimal('amount_max', 10, 2);
|
||||
$table->decimal('amount_min', 10, 2);
|
||||
$table->date('date');
|
||||
$table->boolean('active');
|
||||
|
||||
$table->boolean('automatch');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']);
|
||||
$table->smallInteger('skip')->unsigned();
|
||||
$table->boolean('automatch');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']);
|
||||
$table->smallInteger('skip')->unsigned();
|
||||
|
||||
$table->unique(['user_id','name']);
|
||||
$table->unique(['user_id', 'name']);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('recurring_transactions');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('recurring_transactions');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,48 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentTransactionJournalTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentTransactionJournalTable extends Migration {
|
||||
class CreateComponentTransactionJournalTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_transaction_journal', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_journal_id')->unsigned();
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'component_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_journal_id')->unsigned();
|
||||
|
||||
// link components with component_id
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
// link components with component_id
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
|
||||
// link transaction journals with transaction_journal_id
|
||||
$table->foreign('transaction_journal_id')
|
||||
->references('id')->on('transaction_journals')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// link transaction journals with transaction_journal_id
|
||||
$table->foreign('transaction_journal_id')
|
||||
->references('id')->on('transaction_journals')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_transaction_journal');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_transaction_journal');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,31 +7,33 @@ use Illuminate\Database\Migrations\Migration;
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateSessionTable extends Migration {
|
||||
class CreateSessionTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sessions', function($t)
|
||||
{
|
||||
$t->string('id')->unique();
|
||||
$t->text('payload');
|
||||
$t->integer('last_activity');
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'sessions', function ($t) {
|
||||
$t->string('id')->unique();
|
||||
$t->text('payload');
|
||||
$t->integer('last_activity');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('sessions');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('sessions');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,49 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateLimitsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateLimitsTable extends Migration {
|
||||
class CreateLimitsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('limits', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->date('startdate');
|
||||
$table->decimal('amount',10,2);
|
||||
$table->boolean('repeats');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']);
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'limits', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->date('startdate');
|
||||
$table->decimal('amount', 10, 2);
|
||||
$table->boolean('repeats');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']);
|
||||
|
||||
$table->unique(['component_id','startdate','repeat_freq']);
|
||||
$table->unique(['component_id', 'startdate', 'repeat_freq']);
|
||||
|
||||
// connect component
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// connect component
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('limits');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('limits');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,48 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateLimitRepeatTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateLimitRepeatTable extends Migration {
|
||||
class CreateLimitRepeatTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('limit_repetitions', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('limit_id')->unsigned();
|
||||
$table->date('startdate');
|
||||
$table->date('enddate');
|
||||
$table->decimal('amount',10,2);
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'limit_repetitions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('limit_id')->unsigned();
|
||||
$table->date('startdate');
|
||||
$table->date('enddate');
|
||||
$table->decimal('amount', 10, 2);
|
||||
|
||||
$table->unique(['limit_id','startdate','enddate']);
|
||||
$table->unique(['limit_id', 'startdate', 'enddate']);
|
||||
|
||||
// connect limit
|
||||
$table->foreign('limit_id')
|
||||
->references('id')->on('limits')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// connect limit
|
||||
$table->foreign('limit_id')
|
||||
->references('id')->on('limits')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('limit_repetitions');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('limit_repetitions');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,49 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class RecurringTransactionsToComponents
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class RecurringTransactionsToComponents extends Migration {
|
||||
class RecurringTransactionsToComponents extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_recurring_transaction', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('recurring_transaction_id')->unsigned();
|
||||
$table->boolean('optional');
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'component_recurring_transaction', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('recurring_transaction_id')->unsigned();
|
||||
$table->boolean('optional');
|
||||
|
||||
// link components with component_id
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
// link components with component_id
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
|
||||
// link transaction journals with transaction_journal_id
|
||||
$table->foreign('recurring_transaction_id')
|
||||
->references('id')->on('recurring_transactions')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
// link transaction journals with transaction_journal_id
|
||||
$table->foreign('recurring_transaction_id')
|
||||
->references('id')->on('recurring_transactions')
|
||||
->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_recurring_transaction');
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_recurring_transaction');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,9 +27,6 @@ class Chart implements ChartInterface
|
||||
$return = ['name' => $account->name, 'id' => $account->id, 'data' => []];
|
||||
|
||||
while ($current <= $end) {
|
||||
\Log::debug(
|
||||
'Now at day: ' . $current . '(' . $current->timestamp . '), (' . ($current->timestamp * 1000) . ') '
|
||||
);
|
||||
if ($current > $today) {
|
||||
$return['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)];
|
||||
} else {
|
||||
@ -118,9 +115,6 @@ class Chart implements ChartInterface
|
||||
}]
|
||||
)->orderBy('name', 'ASC')->get();
|
||||
|
||||
$limitInPeriod = 'Envelope for (empty)';
|
||||
$spentInPeriod = 'Spent in (empty)';
|
||||
|
||||
foreach ($budgets as $budget) {
|
||||
$budget->count = 0;
|
||||
foreach ($budget->limits as $limit) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Firefly\Helper\Form;
|
||||
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* Class FormTrigger
|
||||
*
|
||||
|
@ -142,6 +142,7 @@ class MigrationHelper implements MigrationHelperInterface
|
||||
foreach ($this->JSON->components as $entry) {
|
||||
switch ($entry->type->type) {
|
||||
case 'beneficiary':
|
||||
/** @noinspection PhpParamsInspection */
|
||||
$beneficiary = $this->_importBeneficiary($entry, $beneficiaryAT);
|
||||
$this->map['accounts'][$entry->id] = $beneficiary;
|
||||
break;
|
||||
|
@ -62,6 +62,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface
|
||||
}
|
||||
$type = \AccountType::where('description', 'Beneficiary account')->first();
|
||||
|
||||
/** @noinspection PhpParamsInspection */
|
||||
|
||||
return $this->createOrFind($name, $type);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
$fromTransaction->amount = $amountFrom;
|
||||
if (!$fromTransaction->validate()) {
|
||||
throw new FireflyException('Cannot create valid transaction (from): ' . $fromTransaction->errors()->first(
|
||||
));
|
||||
));
|
||||
}
|
||||
$fromTransaction->save();
|
||||
|
||||
@ -141,6 +141,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
|
||||
return $journal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
|
@ -62,16 +62,6 @@ class Account extends Ardent
|
||||
return $this->belongsTo('AccountType');
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an accounts current balance.
|
||||
*
|
||||
@ -92,16 +82,6 @@ class Account extends Ardent
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $date
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function predict(\Carbon\Carbon $date)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transactions.
|
||||
*
|
||||
@ -112,4 +92,26 @@ class Account extends Ardent
|
||||
return $this->hasMany('Transaction');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $date
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function predict(
|
||||
/** @noinspection PhpUnusedParameterInspection */
|
||||
\Carbon\Carbon $date
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
}
|
@ -14,8 +14,10 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$unitTesting = true;
|
||||
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$testEnvironment = 'testing';
|
||||
|
||||
return require __DIR__ . '/../../bootstrap/start.php';
|
||||
|
Loading…
Reference in New Issue
Block a user