Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Migration for rules.
James Colec1346d4c86f4
diff --git a/database/migrations/2016_01_11_193428_changes_for_v370.php b/database/migrations/2016_01_11_193428_changes_for_v370.phpindex 1ca5e7e66f..1a10706457 100644--- a/database/migrations/2016_01_11_193428_changes_for_v370.php+++ b/database/migrations/2016_01_11_193428_changes_for_v370.php@@ -8,6 +8,7 @@*/use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV370@@ -21,7 +22,100 @@ class ChangesForV370 extends Migration*/public function up(){- //+ // new table "rule_groups"+ Schema::create(+ 'rule_groups', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('user_id')->unsigned();+ $table->unsignedSmallInteger('order');+ $table->string('title', 2048);+ $table->mediumText('description');+ $table->unsignedTinyInteger('active')->default(1);++ // connect rule groups to users+ $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');++ // order must be unique for rule group:+ $table->unique(['user_id', 'order']);+ }+ );+++ // new table "rules":+ Schema::create(+ 'rules', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('user_id')->unsigned();+ $table->integer('rule_group_id')->unsigned();+ $table->unsignedSmallInteger('order');+ $table->string('title', 2048);+ $table->mediumText('description');+ $table->unsignedTinyInteger('active')->default(1);+ $table->unsignedTinyInteger('stop_processing')->default(0);++ // connect rules to users+ $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');++ // connect rules to rule groups+ $table->foreign('rule_group_id')->references('id')->on('rule_groups')->onDelete('cascade');++ // order must be unique for rules:+ $table->unique(['user_id', 'order']);+ }+ );+++ // new table "rule_triggers"+ Schema::create(+ 'rule_triggers', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->integer('rule_id')->unsigned();+ $table->unsignedSmallInteger('order');+ $table->string('title', 2048);++ $table->string('trigger_field', 2048);+ $table->string('trigger_type', 1024);+ $table->string('trigger_value', 2048);++ $table->unsignedTinyInteger('active')->default(1);+ $table->unsignedTinyInteger('stop_processing')->default(0);++ // order must be unique for rule triggers:+ $table->unique(['rule_id', 'order']);++ // connect rule tiggers to rules+ $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');+ }+ );++ // new table "rule_actions"+ Schema::create(+ 'rule_actions', function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->integer('rule_id')->unsigned();+ $table->unsignedSmallInteger('order');++ $table->unsignedTinyInteger('active')->default(1);+ $table->unsignedTinyInteger('stop_processing')->default(0);++ $table->string('action_field', 2048);+ $table->string('action', 1024);+ $table->string('action_value', 2048);++ // connect rule actions to rules+ $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');++ // order must be unique for rule triggers:+ $table->unique(['rule_id', 'order']);+ }+ );+}/**@@ -31,6 +125,10 @@ class ChangesForV370 extends Migration*/public function down(){- //+ Schema::drop('rule_actions');+ Schema::drop('rule_triggers');+ Schema::drop('rules');+ Schema::drop('rule_groups');+}}