mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 11:08:28 +00:00
Code cleanup.
This commit is contained in:
@@ -30,19 +30,19 @@ class CreateComponentTransactionJournalTable extends Migration
|
||||
{
|
||||
Schema::create(
|
||||
'component_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_journal_id')->unsigned();
|
||||
$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');
|
||||
|
||||
// combo must be unique:
|
||||
$table->unique(['component_id', 'transaction_journal_id'],'cid_tjid_unique');
|
||||
}
|
||||
// combo must be unique:
|
||||
$table->unique(['component_id', 'transaction_journal_id'], 'cid_tjid_unique');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -30,21 +30,21 @@ class CreateComponentRecurringTransactionTable extends Migration
|
||||
{
|
||||
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');
|
||||
$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');
|
||||
|
||||
// component and recurring transaction must be unique.
|
||||
$table->unique(['component_id','recurring_transaction_id'],'cid_rtid_unique');
|
||||
// component and recurring transaction must be unique.
|
||||
$table->unique(['component_id', 'recurring_transaction_id'], 'cid_rtid_unique');
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
/**
|
||||
* Class ChangesForV321
|
||||
*/
|
||||
class ChangesForV321 extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::update(DB::raw('RENAME TABLE `budget_limits` TO `limits`;'));
|
||||
DB::update(DB::raw('ALTER TABLE `limit_repetitions` ALGORITHM=INPLACE, CHANGE `budget_limit_id` `limit_id` INT UNSIGNED NOT NULL'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::update(DB::raw('RENAME TABLE `limits` TO `budget_limits`;'));
|
||||
DB::update(DB::raw('ALTER TABLE `limit_repetitions` ALGORITHM=INPLACE, CHANGE `limit_id` `budget_limit_id` INT UNSIGNED NOT NULL'));
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -17,8 +17,6 @@ class TestContentSeeder extends Seeder
|
||||
$revenueType = AccountType::whereType('Revenue account')->first();
|
||||
$ibType = AccountType::whereType('Initial balance account')->first();
|
||||
|
||||
$euro = TransactionCurrency::whereCode('EUR')->first();
|
||||
|
||||
$obType = TransactionType::whereType('Opening balance')->first();
|
||||
$withdrawal = TransactionType::whereType('Withdrawal')->first();
|
||||
$transfer = TransactionType::whereType('Transfer')->first();
|
||||
@@ -132,11 +130,15 @@ class TestContentSeeder extends Seeder
|
||||
* @param $description
|
||||
* @param $date
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Category $category
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function createTransaction(
|
||||
Account $from, Account $to, $amount, TransactionType $type, $description, $date, Budget $budget = null, Category $category = null
|
||||
) {
|
||||
)
|
||||
{
|
||||
$user = User::whereEmail('thegrumpydictator@gmail.com')->first();
|
||||
$euro = TransactionCurrency::whereCode('EUR')->first();
|
||||
|
||||
|
Reference in New Issue
Block a user