mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 20:38:57 +00:00
Various small updates [skip ci]
This commit is contained in:
@@ -21,7 +21,9 @@ class CreateUsersTable extends Migration {
|
||||
$table->string('reset',32)->nullable();
|
||||
$table->string('remember_token',255)->nullable();
|
||||
$table->boolean('migrated');
|
||||
});
|
||||
|
||||
$table->unique('email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,8 @@ class CreateAccountsTable extends Migration {
|
||||
$table->foreign('account_type_id')
|
||||
->references('id')->on('account_types')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','account_type_id','name']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ class CreateComponentsTable extends Migration {
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id','class','name']);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ class CreatePiggybanksTable extends Migration
|
||||
$table->timestamps();
|
||||
$table->integer('account_id')->unsigned();
|
||||
$table->date('targetdate')->nullable();
|
||||
$table->string('name', 500);
|
||||
$table->string('name', 100);
|
||||
$table->decimal('amount', 10, 2);
|
||||
$table->decimal('target', 10, 2)->nullable();
|
||||
$table->integer('order')->unsigned();
|
||||
@@ -28,6 +28,7 @@ class CreatePiggybanksTable extends Migration
|
||||
$table->foreign('account_id')
|
||||
->references('id')->on('accounts')
|
||||
->onDelete('cascade');
|
||||
$table->unique(['account_id','name']);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
@@ -12,10 +12,20 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('recurringtransactions', function(Blueprint $table)
|
||||
Schema::create('recurring_transactions', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
$table->string('name',50);
|
||||
$table->decimal('amount_max',10,2);
|
||||
$table->decimal('amount_min',10,2);
|
||||
$table->boolean('active');
|
||||
$table->enum('repeat_freq', ['daily', 'weekly','monthly','quarterly','half-year','yearly']);
|
||||
|
||||
$table->unique(['user_id','name']);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +36,7 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('recurringtransactions');
|
||||
Schema::drop('recurring_transactions');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RecurringTransactionsToComponents extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_recurring_transaction', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('recurring_transaction_id')->unsigned();
|
||||
|
||||
// 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');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('component_recurring_transaction');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user