All kinds of new stuff: finished most of the importing routines, extended the database (single table inheritance) and expanded some other stuff.

This commit is contained in:
James Cole
2014-07-05 19:44:26 +02:00
parent a0c0dc288d
commit 188105492c
26 changed files with 430 additions and 587 deletions

View File

@@ -18,18 +18,13 @@ class CreateComponentsTable extends Migration {
$table->timestamps();
$table->string('name',50);
$table->integer('user_id')->unsigned();
$table->integer('component_type_id')->unsigned();
$table->string('class',20);
// connect components to users
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
// connect components to component types
$table->foreign('component_type_id')
->references('id')->on('component_types')
->onDelete('cascade');
});
});
}
/**

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePiggybanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'piggybanks', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('account_id')->unsigned();
$table->date('targetdate')->nullable();
$table->string('name', 500);
$table->decimal('amount', 10, 2);
$table->decimal('target', 10, 2)->nullable();
$table->integer('order')->unsigned();
// connect account to piggybank.
$table->foreign('account_id')
->references('id')->on('accounts')
->onDelete('cascade');
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('piggybanks');
}
}

View File

@@ -3,7 +3,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateComponentTypesTable extends Migration {
class CreateRecurringTransactionsTable extends Migration {
/**
* Run the migrations.
@@ -12,11 +12,10 @@ class CreateComponentTypesTable extends Migration {
*/
public function up()
{
Schema::create('component_types', function(Blueprint $table)
Schema::create('recurringtransactions', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->string('type',50);
});
}
@@ -27,7 +26,7 @@ class CreateComponentTypesTable extends Migration {
*/
public function down()
{
Schema::drop('component_types');
Schema::drop('recurringtransactions');
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateComponentTransactionJournalTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('component_transaction_journal', function(Blueprint $table)
{
$table->increments('id');
$table->integer('component_id')->unsigned();
$table->integer('transaction_journal_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('transaction_journal_id')
->references('id')->on('transaction_journals')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('component_transaction_journal');
}
}

View File

@@ -1,16 +0,0 @@
<?php
class ComponentTypeSeeder extends Seeder
{
public function run()
{
DB::table('component_types')->delete();
ComponentType::create(['type' => 'category']);
ComponentType::create(['type' => 'budget']);
}
}

View File

@@ -15,7 +15,6 @@ class DatabaseSeeder extends Seeder
$this->call('AccountTypeSeeder');
$this->call('TransactionCurrencySeeder');
$this->call('TransactionTypeSeeder');
$this->call('ComponentTypeSeeder');
$this->call('DefaultUserSeeder');
}