mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Code clean up.
This commit is contained in:
@@ -167,7 +167,6 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function hasRole(string $name): bool
|
||||
{
|
||||
|
||||
foreach ($this->roles as $role) {
|
||||
if ($role->name === $name) {
|
||||
return true;
|
||||
@@ -262,6 +261,4 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
@@ -25,7 +24,8 @@ use Carbon\Carbon;
|
||||
*/
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\User::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\User::class,
|
||||
function (Faker\Generator $faker) {
|
||||
static $password;
|
||||
|
||||
return [
|
||||
@@ -37,8 +37,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\CurrencyExchangeRate::class, function (Faker\Generator $faker) {
|
||||
|
||||
FireflyIII\Models\CurrencyExchangeRate::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'from_currency_id' => 1,
|
||||
@@ -51,8 +51,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\TransactionCurrency::class, function (Faker\Generator $faker) {
|
||||
|
||||
FireflyIII\Models\TransactionCurrency::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'name' => $faker->words(1, true),
|
||||
'code' => 'ABC',
|
||||
@@ -62,7 +62,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\ImportJob::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\ImportJob::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 100),
|
||||
'user_id' => 1,
|
||||
@@ -83,7 +84,8 @@ $factory->define(
|
||||
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\TransactionJournal::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\TransactionJournal::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(1000, 10000),
|
||||
'user_id' => 1,
|
||||
@@ -105,7 +107,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Bill::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Bill::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'user_id' => 1,
|
||||
@@ -124,7 +127,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\PiggyBankRepetition::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\PiggyBankRepetition::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(100, 10000),
|
||||
'piggy_bank_id' => $faker->numberBetween(1, 10),
|
||||
@@ -136,7 +140,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\PiggyBank::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\PiggyBank::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(100, 10000),
|
||||
'account_id' => $faker->numberBetween(1, 10),
|
||||
@@ -151,7 +156,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Tag::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Tag::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(200, 10000),
|
||||
'user_id' => 1,
|
||||
@@ -162,7 +168,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Category::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Category::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'name' => $faker->words(3, true),
|
||||
@@ -171,7 +178,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Budget::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Budget::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'name' => $faker->words(3, true),
|
||||
@@ -180,7 +188,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\PiggyBankEvent::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\PiggyBankEvent::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'piggy_bank_id' => $faker->numberBetween(1, 10),
|
||||
@@ -192,7 +201,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\BudgetLimit::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\BudgetLimit::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->numberBetween(1, 10),
|
||||
'start_date' => '2017-01-01',
|
||||
@@ -205,7 +215,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Account::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Account::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(1000, 10000),
|
||||
'name' => $faker->words(3, true),
|
||||
@@ -216,7 +227,8 @@ $factory->define(
|
||||
);
|
||||
|
||||
$factory->define(
|
||||
FireflyIII\Models\Transaction::class, function (Faker\Generator $faker) {
|
||||
FireflyIII\Models\Transaction::class,
|
||||
function (Faker\Generator $faker) {
|
||||
return [
|
||||
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
|
||||
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
|
||||
|
@@ -24,7 +24,6 @@ class CreateSupportTables extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::drop('account_types');
|
||||
Schema::drop('transaction_currencies');
|
||||
Schema::drop('transaction_types');
|
||||
@@ -35,7 +34,6 @@ class CreateSupportTables extends Migration
|
||||
Schema::drop('roles');
|
||||
Schema::drop('sessions');
|
||||
Schema::drop('configuration');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +62,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('account_types')) {
|
||||
Schema::create(
|
||||
'account_types', function (Blueprint $table) {
|
||||
'account_types',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('type', 50);
|
||||
@@ -80,8 +79,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('configuration')) {
|
||||
Schema::create(
|
||||
'configuration', function (Blueprint $table) {
|
||||
|
||||
'configuration',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -100,7 +99,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('transaction_currencies')) {
|
||||
Schema::create(
|
||||
'transaction_currencies', function (Blueprint $table) {
|
||||
'transaction_currencies',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -110,7 +110,6 @@ class CreateSupportTables extends Migration
|
||||
|
||||
// code must be unique.
|
||||
$table->unique(['code']);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -123,7 +122,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('jobs')) {
|
||||
Schema::create(
|
||||
'jobs', function (Blueprint $table) {
|
||||
'jobs',
|
||||
function (Blueprint $table) {
|
||||
|
||||
// straight from Laravel
|
||||
$table->bigIncrements('id');
|
||||
@@ -135,7 +135,6 @@ class CreateSupportTables extends Migration
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
$table->index(['queue', 'reserved', 'reserved_at']);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -148,12 +147,12 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('password_resets')) {
|
||||
Schema::create(
|
||||
'password_resets', function (Blueprint $table) {
|
||||
'password_resets',
|
||||
function (Blueprint $table) {
|
||||
// straight from laravel
|
||||
$table->string('email')->index();
|
||||
$table->string('token')->index();
|
||||
$table->timestamp('created_at');
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -166,7 +165,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('permission_role')) {
|
||||
Schema::create(
|
||||
'permission_role', function (Blueprint $table) {
|
||||
'permission_role',
|
||||
function (Blueprint $table) {
|
||||
$table->integer('permission_id')->unsigned();
|
||||
$table->integer('role_id')->unsigned();
|
||||
|
||||
@@ -186,7 +186,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('permissions')) {
|
||||
Schema::create(
|
||||
'permissions', function (Blueprint $table) {
|
||||
'permissions',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('name')->unique();
|
||||
@@ -204,7 +205,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('roles')) {
|
||||
Schema::create(
|
||||
'roles', function (Blueprint $table) {
|
||||
'roles',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('name')->unique();
|
||||
@@ -220,10 +222,10 @@ class CreateSupportTables extends Migration
|
||||
*/
|
||||
private function createSessionsTable()
|
||||
{
|
||||
|
||||
if (!Schema::hasTable('sessions')) {
|
||||
Schema::create(
|
||||
'sessions', function (Blueprint $table) {
|
||||
'sessions',
|
||||
function (Blueprint $table) {
|
||||
$table->string('id')->unique();
|
||||
$table->integer('user_id')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
@@ -242,7 +244,8 @@ class CreateSupportTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('transaction_types')) {
|
||||
Schema::create(
|
||||
'transaction_types', function (Blueprint $table) {
|
||||
'transaction_types',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -250,7 +253,6 @@ class CreateSupportTables extends Migration
|
||||
|
||||
// type must be unique.
|
||||
$table->unique(['type']);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -35,7 +35,8 @@ class CreateUsersTable extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('users')) {
|
||||
Schema::create(
|
||||
'users', function (Blueprint $table) {
|
||||
'users',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('email', 255);
|
||||
|
@@ -82,7 +82,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('accounts')) {
|
||||
Schema::create(
|
||||
'accounts', function (Blueprint $table) {
|
||||
'accounts',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -101,7 +102,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('account_meta')) {
|
||||
Schema::create(
|
||||
'account_meta', function (Blueprint $table) {
|
||||
'account_meta',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('account_id', false, true);
|
||||
@@ -118,10 +120,10 @@ class CreateMainTables extends Migration
|
||||
*/
|
||||
private function createAttachmentsTable()
|
||||
{
|
||||
|
||||
if (!Schema::hasTable('attachments')) {
|
||||
Schema::create(
|
||||
'attachments', function (Blueprint $table) {
|
||||
'attachments',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -139,8 +141,6 @@ class CreateMainTables extends Migration
|
||||
|
||||
// link user id to users table
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -153,7 +153,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('bills')) {
|
||||
Schema::create(
|
||||
'bills', function (Blueprint $table) {
|
||||
'bills',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -184,7 +185,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('budgets')) {
|
||||
Schema::create(
|
||||
'budgets', function (Blueprint $table) {
|
||||
'budgets',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -193,14 +195,13 @@ class CreateMainTables extends Migration
|
||||
$table->boolean('active')->default(1);
|
||||
$table->boolean('encrypted')->default(0);
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
if (!Schema::hasTable('budget_limits')) {
|
||||
Schema::create(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('budget_id', false, true);
|
||||
@@ -209,13 +210,13 @@ class CreateMainTables extends Migration
|
||||
$table->string('repeat_freq', 30);
|
||||
$table->boolean('repeats')->default(0);
|
||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
if (!Schema::hasTable('limit_repetitions')) {
|
||||
Schema::create(
|
||||
'limit_repetitions', function (Blueprint $table) {
|
||||
'limit_repetitions',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('budget_limit_id', false, true);
|
||||
@@ -235,8 +236,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('categories')) {
|
||||
Schema::create(
|
||||
'categories', function (Blueprint $table) {
|
||||
|
||||
'categories',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -258,7 +259,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('export_jobs')) {
|
||||
Schema::create(
|
||||
'export_jobs', function (Blueprint $table) {
|
||||
'export_jobs',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id', false, true);
|
||||
@@ -271,7 +273,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('import_jobs')) {
|
||||
Schema::create(
|
||||
'import_jobs', function (Blueprint $table) {
|
||||
'import_jobs',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
@@ -283,7 +286,6 @@ class CreateMainTables extends Migration
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,7 +295,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('piggy_banks')) {
|
||||
Schema::create(
|
||||
'piggy_banks', function (Blueprint $table) {
|
||||
'piggy_banks',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -312,7 +315,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('piggy_bank_repetitions')) {
|
||||
Schema::create(
|
||||
'piggy_bank_repetitions', function (Blueprint $table) {
|
||||
'piggy_bank_repetitions',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('piggy_bank_id', false, true);
|
||||
@@ -332,7 +336,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('preferences')) {
|
||||
Schema::create(
|
||||
'preferences', function (Blueprint $table) {
|
||||
'preferences',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id', false, true);
|
||||
@@ -350,10 +355,10 @@ class CreateMainTables extends Migration
|
||||
*/
|
||||
private function createRoleTable()
|
||||
{
|
||||
|
||||
if (!Schema::hasTable('role_user')) {
|
||||
Schema::create(
|
||||
'role_user', function (Blueprint $table) {
|
||||
'role_user',
|
||||
function (Blueprint $table) {
|
||||
$table->integer('user_id', false, true);
|
||||
$table->integer('role_id', false, true);
|
||||
|
||||
@@ -361,11 +366,9 @@ class CreateMainTables extends Migration
|
||||
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['user_id', 'role_id']);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,7 +379,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('rule_groups')) {
|
||||
Schema::create(
|
||||
'rule_groups', function (Blueprint $table) {
|
||||
'rule_groups',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -393,7 +397,8 @@ class CreateMainTables extends Migration
|
||||
}
|
||||
if (!Schema::hasTable('rules')) {
|
||||
Schema::create(
|
||||
'rules', function (Blueprint $table) {
|
||||
'rules',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -415,7 +420,8 @@ class CreateMainTables extends Migration
|
||||
}
|
||||
if (!Schema::hasTable('rule_actions')) {
|
||||
Schema::create(
|
||||
'rule_actions', function (Blueprint $table) {
|
||||
'rule_actions',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('rule_id', false, true);
|
||||
@@ -435,7 +441,8 @@ class CreateMainTables extends Migration
|
||||
}
|
||||
if (!Schema::hasTable('rule_triggers')) {
|
||||
Schema::create(
|
||||
'rule_triggers', function (Blueprint $table) {
|
||||
'rule_triggers',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('rule_id', false, true);
|
||||
@@ -462,7 +469,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('tags')) {
|
||||
Schema::create(
|
||||
'tags', function (Blueprint $table) {
|
||||
'tags',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -478,7 +486,6 @@ class CreateMainTables extends Migration
|
||||
|
||||
// link user id to users table
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -493,7 +500,8 @@ class CreateMainTables extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('transaction_journals')) {
|
||||
Schema::create(
|
||||
'transaction_journals', function (Blueprint $table) {
|
||||
'transaction_journals',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -520,7 +528,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('journal_meta')) {
|
||||
Schema::create(
|
||||
'journal_meta', function (Blueprint $table) {
|
||||
'journal_meta',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
@@ -534,21 +543,21 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('tag_transaction_journal')) {
|
||||
Schema::create(
|
||||
'tag_transaction_journal', function (Blueprint $table) {
|
||||
'tag_transaction_journal',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('tag_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('budget_transaction_journal')) {
|
||||
Schema::create(
|
||||
'budget_transaction_journal', function (Blueprint $table) {
|
||||
'budget_transaction_journal',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('budget_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
@@ -560,7 +569,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('category_transaction_journal')) {
|
||||
Schema::create(
|
||||
'category_transaction_journal', function (Blueprint $table) {
|
||||
'category_transaction_journal',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('category_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
@@ -573,7 +583,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('piggy_bank_events')) {
|
||||
Schema::create(
|
||||
'piggy_bank_events', function (Blueprint $table) {
|
||||
'piggy_bank_events',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('piggy_bank_id', false, true);
|
||||
@@ -589,7 +600,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('transactions')) {
|
||||
Schema::create(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -600,14 +612,14 @@ class CreateMainTables extends Migration
|
||||
|
||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('budget_transaction')) {
|
||||
Schema::create(
|
||||
'budget_transaction', function (Blueprint $table) {
|
||||
'budget_transaction',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('budget_id', false, true);
|
||||
$table->integer('transaction_id', false, true);
|
||||
@@ -620,7 +632,8 @@ class CreateMainTables extends Migration
|
||||
|
||||
if (!Schema::hasTable('category_transaction')) {
|
||||
Schema::create(
|
||||
'category_transaction', function (Blueprint $table) {
|
||||
'category_transaction',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('category_id', false, true);
|
||||
$table->integer('transaction_id', false, true);
|
||||
|
@@ -34,7 +34,8 @@ class ChangesFor3101 extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'import_jobs', function (Blueprint $table) {
|
||||
'import_jobs',
|
||||
function (Blueprint $table) {
|
||||
$table->text('extended_status')->nullable();
|
||||
}
|
||||
);
|
||||
|
@@ -24,7 +24,6 @@ class FixNullables extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,13 +34,15 @@ class FixNullables extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'rule_groups', function (Blueprint $table) {
|
||||
'rule_groups',
|
||||
function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->change();
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'rules', function (Blueprint $table) {
|
||||
'rules',
|
||||
function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->change();
|
||||
}
|
||||
);
|
||||
|
@@ -35,7 +35,8 @@ class ExpandTransactionsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->smallInteger('identifier', false, true)->default(0);
|
||||
}
|
||||
);
|
||||
|
@@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
|
||||
/**
|
||||
* Class ChangesForV410
|
||||
*/
|
||||
@@ -36,7 +35,8 @@ class ChangesForV410 extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'notes', function (Blueprint $table) {
|
||||
'notes',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
@@ -35,7 +35,8 @@ class ChangesForV420 extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'journal_meta', function (Blueprint $table) {
|
||||
'journal_meta',
|
||||
function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
);
|
||||
|
@@ -36,7 +36,8 @@ class ChangesForV430 extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'available_budgets', function (Blueprint $table) {
|
||||
'available_budgets',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
@@ -28,12 +28,14 @@ class ChangesForV431 extends Migration
|
||||
{
|
||||
// reinstate "repeats" and "repeat_freq".
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->string('repeat_freq', 30)->nullable();
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->boolean('repeats')->default(0);
|
||||
}
|
||||
);
|
||||
@@ -41,11 +43,11 @@ class ChangesForV431 extends Migration
|
||||
|
||||
// remove date field "end_date"
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn('end_date');
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,38 +59,40 @@ class ChangesForV431 extends Migration
|
||||
{
|
||||
// add decimal places to "transaction currencies".
|
||||
Schema::table(
|
||||
'transaction_currencies', function (Blueprint $table) {
|
||||
'transaction_currencies',
|
||||
function (Blueprint $table) {
|
||||
$table->smallInteger('decimal_places', false, true)->default(2);
|
||||
}
|
||||
);
|
||||
|
||||
// change field "startdate" to "start_date"
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->renameColumn('startdate', 'start_date');
|
||||
}
|
||||
);
|
||||
|
||||
// add date field "end_date" after "start_date"
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->date('end_date')->nullable()->after('start_date');
|
||||
}
|
||||
);
|
||||
|
||||
// drop "repeats" and "repeat_freq".
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn('repeats');
|
||||
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'budget_limits', function (Blueprint $table) {
|
||||
'budget_limits',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn('repeat_freq');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,8 @@ class ChangesForV440 extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('currency_exchange_rates')) {
|
||||
Schema::create(
|
||||
'currency_exchange_rates', function (Blueprint $table) {
|
||||
'currency_exchange_rates',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -61,11 +62,11 @@ class ChangesForV440 extends Migration
|
||||
}
|
||||
//
|
||||
Schema::table(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->integer('transaction_currency_id', false, true)->after('description')->nullable();
|
||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -39,14 +39,16 @@ class ChangesForV450 extends Migration
|
||||
{
|
||||
// add "foreign_amount" to transactions
|
||||
Schema::table(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->decimal('foreign_amount', 22, 12)->nullable()->after('amount');
|
||||
}
|
||||
);
|
||||
|
||||
// add foreign transaction currency id to transactions (is nullable):
|
||||
Schema::table(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->integer('foreign_currency_id', false, true)->default(null)->after('foreign_amount')->nullable();
|
||||
$table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ class ChangesForV470 extends Migration
|
||||
{
|
||||
Schema::dropIfExists('journal_links');
|
||||
Schema::dropIfExists('link_types');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,8 @@ class ChangesForV470 extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('link_types')) {
|
||||
Schema::create(
|
||||
'link_types', function (Blueprint $table) {
|
||||
'link_types',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
@@ -49,7 +49,8 @@ class ChangesForV470 extends Migration
|
||||
|
||||
if (!Schema::hasTable('journal_links')) {
|
||||
Schema::create(
|
||||
'journal_links', function (Blueprint $table) {
|
||||
'journal_links',
|
||||
function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('link_type_id', false, true);
|
||||
@@ -62,8 +63,6 @@ class ChangesForV470 extends Migration
|
||||
$table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
|
||||
$table->unique(['link_type_id','source_id','destination_id']);
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -27,7 +27,8 @@ class ChangesForV470a extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'transactions', function (Blueprint $table) {
|
||||
'transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->boolean('reconciled')->after('deleted_at')->default(0);
|
||||
}
|
||||
);
|
||||
|
@@ -31,6 +31,4 @@ class AccountTypeSeeder extends Seeder
|
||||
AccountType::create(['type' => 'Import account']);
|
||||
AccountType::create(['type' => 'Loan']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -29,6 +29,5 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(TransactionTypeSeeder::class);
|
||||
$this->call(PermissionSeeder::class);
|
||||
$this->call(LinkTypeSeeder::class);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,5 @@ class LinkTypeSeeder extends Seeder
|
||||
$link->outward = '(partially) reimburses';
|
||||
$link->editable = false;
|
||||
$link->save();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -33,7 +33,5 @@ class PermissionSeeder extends Seeder
|
||||
$demo->display_name = 'Demo User';
|
||||
$demo->description = 'User is a demo user';
|
||||
$demo->save();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -30,5 +30,4 @@ class TransactionCurrencySeeder extends Seeder
|
||||
TransactionCurrency::create(['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => 'B', 'decimal_places' => 8]);
|
||||
TransactionCurrency::create(['code' => 'JPY', 'name' => 'Japanese yen', 'symbol' => '¥', 'decimal_places' => 2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,5 +26,4 @@ class TransactionTypeSeeder extends Seeder
|
||||
TransactionType::create(['type' => TransactionType::TRANSFER]);
|
||||
TransactionType::create(['type' => TransactionType::OPENING_BALANCE]);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user