Code cleanup.

This commit is contained in:
James Cole
2014-12-14 20:40:02 +01:00
parent 8e6ca0dd05
commit 900dea2c66
36 changed files with 384 additions and 1094 deletions

View File

@@ -46,7 +46,7 @@ class CreatePiggybanksTable extends Migration
$table->boolean('remind_me');
$table->integer('order')->unsigned();
// connect account to piggybank.
// connect account to piggy bank.
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
// for an account, the name must be unique.

View File

@@ -3,6 +3,8 @@
use Illuminate\Database\Migrations\Migration;
/**
* SuppressWarnings(PHPMD.ShortMethodName)
*
* Class ChangesForV321
*/
class ChangesForV321 extends Migration
@@ -15,9 +17,9 @@ class ChangesForV321 extends Migration
*/
public function down()
{
DB::update(DB::raw('RENAME TABLE `budget_limits` TO `limits`;'));
Schema::rename('budget_limits','limits');
DB::update(DB::raw('ALTER TABLE `limit_repetitions` ALGORITHM=INPLACE, CHANGE `budget_limit_id` `limit_id` INT UNSIGNED NOT NULL'));
DB::update(DB::Raw('ALTER TABLE `transactions` ADD `piggybank_id` int(10) unsigned DEFAULT NULL AFTER `account_id`;'));
}
/**
@@ -27,8 +29,9 @@ class ChangesForV321 extends Migration
*/
public function up()
{
DB::update(DB::raw('RENAME TABLE `limits` TO `budget_limits`;'));
Schema::rename('limits','budget_limits');
DB::update(DB::raw('ALTER TABLE `limit_repetitions` ALGORITHM=INPLACE, CHANGE `limit_id` `budget_limit_id` INT UNSIGNED NOT NULL'));
DB::update(DB::Raw('ALTER TABLE `transactions` DROP `piggybank_id`'));
}

View File

@@ -28,6 +28,7 @@ class TestContentSeeder extends Seeder
// create two asset accounts.
$checking = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Checking account', 'active' => 1]);
$savings = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Savings account', 'active' => 1]);
/** @noinspection PhpUnusedLocalVariableInspection */
$deleteMe = Account::create(['user_id' => $user->id, 'account_type_id' => $assetType->id, 'name' => 'Delete me', 'active' => 1]);
// create two budgets: