Skip to content

Firefly III: a personal finances manager

Prep for solid multi-currency configuration.

James Cole4ff5f33966a8
diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.php
new file mode 100644
index 0000000000..f0f39c839d
--- /dev/null
+++ b/database/migrations/2017_06_02_105232_changes_for_v450.php
@@ -0,0 +1,42 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+/**
+ * Class ChangesForV450
+ */
+class ChangesForV450 extends Migration
+{
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ }
+
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ // add "foreign_amount" to transactions
+ Schema::table(
+ 'transactions', function (Blueprint $table) {
+ $table->decimal('foreign_amount', 22, 12)->after('amount');
+ }
+ );
+
+ // add foreign transaction currency id to transactions (is nullable):
+ Schema::table(
+ 'transactions', function (Blueprint $table) {
+ $table->integer('foreign_currency_id', false, true)->after('foreign_amount')->nullable();
+ $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
+ }
+ );
+ }
+}