diff --git a/db/migrations/20251005183109_calendar_add_fields.php b/db/migrations/20251005183109_calendar_add_fields.php new file mode 100644 index 000000000..d5375fcd2 --- /dev/null +++ b/db/migrations/20251005183109_calendar_add_fields.php @@ -0,0 +1,83 @@ +getEnvironment() == "thetool") { + $table = $this->table('Calendar'); + if (!$table->hasColumn('calendar_name')) { + $table->addColumn('calendar_name', 'string', [ + 'limit' => 255, + 'null' => true, + 'after' => 'user_id', + ]); + } + if (!$table->hasColumn('calendar_firstname')) { + $table->addColumn('calendar_firstname', 'string', [ + 'limit' => 100, + 'null' => true, + 'after' => 'calendar_name', + ]); + } + if (!$table->hasColumn('calendar_lastname')) { + $table->addColumn('calendar_lastname', 'string', [ + 'limit' => 100, + 'null' => true, + 'after' => 'calendar_firstname', + ]); + } + if (!$table->hasColumn('calendar_email')) { + $table->addColumn('calendar_email', 'string', [ + 'limit' => 255, + 'null' => true, + 'after' => 'calendar_name', // wie in deinem SQL + ]); + } + if ($table->hasColumn('user_id')) { + $table->changeColumn('user_id', 'integer', [ + 'null' => true, + 'default' => null, + ]); + } + if ($table->hasColumn('microsoft_id')) { + $table->changeColumn('microsoft_id', 'text', [ + 'null' => true, + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + ]); + } + $table->update(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + $table = $this->table('Calendar'); + if ($table->hasColumn('calendar_email')) { + $table->removeColumn('calendar_email'); + } + if ($table->hasColumn('calendar_lastname')) { + $table->removeColumn('calendar_lastname'); + } + if ($table->hasColumn('calendar_firstname')) { + $table->removeColumn('calendar_firstname'); + } + if ($table->hasColumn('calendar_name')) { + $table->removeColumn('calendar_name'); + } + } + + if($this->getEnvironment() == "addressdb") { + + } + } +}