Skip to content

Firefly III: a personal finances manager

Fix for #2017

James Coleed08d299de91
diff --git a/database/migrations/2019_02_05_055516_changes_for_v4711.php b/database/migrations/2019_02_05_055516_changes_for_v4711.php
index e89902f9e8..c05b293ac2 100644
--- a/database/migrations/2019_02_05_055516_changes_for_v4711.php
+++ b/database/migrations/2019_02_05_055516_changes_for_v4711.php
@@ -45,9 +45,17 @@ class ChangesForV4711 extends Migration
*/
public function up(): void
{
+ /**
+ * In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc
+ * because apparently MySQL is not actually capable of handling multiple time zones,
+ * only having a server wide time zone setting. Actual database schemes like Postgres
+ * handle this just fine but the combination is unpredictable. So we go back to
+ * datetime (without a time zone) for all database engines because MySQL refuses to play
+ * nice.
+ */
Schema::table(
'transaction_journals', function (Blueprint $table) {
- $table->dateTimeTz('date')->change();
+ $table->dateTime('date')->change();
}
);
diff --git a/database/migrations/2019_02_11_170529_changes_for_v4712.php b/database/migrations/2019_02_11_170529_changes_for_v4712.php
new file mode 100644
index 0000000000..f0a9276cd2
--- /dev/null
+++ b/database/migrations/2019_02_11_170529_changes_for_v4712.php
@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+/**
+ * Class ChangesForV4712
+ */
+class ChangesForV4712 extends Migration
+{
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ //
+ }
+
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up(): void
+ {
+ /**
+ * In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc
+ * because apparently MySQL is not actually capable of handling multiple time zones,
+ * only having a server wide time zone setting. Actual database schemes like Postgres
+ * handle this just fine but the combination is unpredictable. So we go back to
+ * datetime (without a time zone) for all database engines because MySQL refuses to play
+ * nice.
+ */
+ Schema::table(
+ 'transaction_journals', function (Blueprint $table) {
+ $table->dateTime('date')->change();
+ }
+ );
+ }
+}