mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
New test content.
This commit is contained in:
@@ -75,22 +75,6 @@ class ChangesForV321 extends Migration
|
||||
|
||||
}
|
||||
|
||||
public function createComponentId() {
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
$table->integer('component_id')->unsigned();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function createComponentIdForeignKey() {
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
$table->foreign('component_id')->references('id')->on('components')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function moveBudgetsBack()
|
||||
{
|
||||
Budget::get()->each(
|
||||
@@ -121,6 +105,15 @@ class ChangesForV321 extends Migration
|
||||
);
|
||||
}
|
||||
|
||||
public function createComponentId()
|
||||
{
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
$table->integer('component_id')->unsigned();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function updateComponentInBudgetLimits()
|
||||
{
|
||||
BudgetLimit::get()->each(
|
||||
@@ -138,6 +131,15 @@ class ChangesForV321 extends Migration
|
||||
);
|
||||
}
|
||||
|
||||
public function createComponentIdForeignKey()
|
||||
{
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
$table->foreign('component_id','limits_component_id_foreign')->references('id')->on('components')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function dropBudgetIdColumnInBudgetLimits()
|
||||
{
|
||||
Schema::table(
|
||||
@@ -411,18 +413,28 @@ class ChangesForV321 extends Migration
|
||||
|
||||
public function moveComponentIdToBudgetId()
|
||||
{
|
||||
\Log::debug('Now in moveComponentIdToBudgetId()');
|
||||
BudgetLimit::get()->each(
|
||||
function (BudgetLimit $bl) {
|
||||
\Log::debug('Now at budgetLimit #' . $bl->id . ' with component_id: ' . $bl->component_id);
|
||||
$component = Component::find($bl->component_id);
|
||||
if ($component) {
|
||||
\Log::debug('Found component with id #' . $component->id . ' and name ' . $component->name);
|
||||
$budget = Budget::whereName($component->name)->whereUserId($component->user_id)->first();
|
||||
if ($budget) {
|
||||
\Log::debug('Found a budget with ID #' . $budget->id . ' and name ' . $budget->name);
|
||||
$bl->budget_id = $budget->id;
|
||||
$bl->save();
|
||||
\Log::debug('Connected budgetLimit #' . $bl->id . ' to budget_id' . $budget->id);
|
||||
} else {
|
||||
\Log::debug('Could not find a matching budget with name ' . $component->name);
|
||||
}
|
||||
} else {
|
||||
\Log::debug('Could not find a component with id ' . $bl->component_id);
|
||||
}
|
||||
}
|
||||
);
|
||||
\Log::debug('Done with moveComponentIdToBudgetId()');
|
||||
|
||||
}
|
||||
|
||||
|
@@ -96,8 +96,8 @@ class TestContentSeeder extends Seeder
|
||||
'order' => 0,
|
||||
]
|
||||
);
|
||||
$piggyBankEvent = PiggyBankEvent::create(['piggybank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
$piggyBankRepetition = PiggybankRepetition::create(
|
||||
PiggyBankEvent::create(['piggybank_id' => 1, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggybankRepetition::create(
|
||||
[
|
||||
'piggybank_id' => $piggy->id,
|
||||
'startdate' => Carbon::now()->format('Y-m-d'),
|
||||
@@ -106,6 +106,35 @@ class TestContentSeeder extends Seeder
|
||||
]
|
||||
);
|
||||
|
||||
// piggy bank
|
||||
$piggyTargeted = Piggybank::create(
|
||||
[
|
||||
'account_id' => $savings->id,
|
||||
'name' => 'New clothes',
|
||||
'targetamount' => 2000,
|
||||
'startdate' => Carbon::now()->format('Y-m-d'),
|
||||
'targetdate' => Carbon::now()->addMonths(4)->format('Y-m-d'),
|
||||
'repeats' => 0,
|
||||
'rep_length' => null,
|
||||
'rep_every' => 0,
|
||||
'rep_times' => null,
|
||||
'reminder' => null,
|
||||
'reminder_skip' => 0,
|
||||
'remind_me' => 0,
|
||||
'order' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
PiggyBankEvent::create(['piggybank_id' => $piggyTargeted->id, 'date' => $startDate->format('Y-m-d'), 'amount' => 100]);
|
||||
PiggybankRepetition::create(
|
||||
[
|
||||
'piggybank_id' => $piggyTargeted->id,
|
||||
'startdate' => Carbon::now()->format('Y-m-d'),
|
||||
'targetdate' => Carbon::now()->addMonths(4)->format('Y-m-d'),
|
||||
'currentamount' => 0
|
||||
]
|
||||
);
|
||||
|
||||
// recurring transaction
|
||||
$recurring = \RecurringTransaction::create(
|
||||
[
|
||||
|
Reference in New Issue
Block a user