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