Kalenderupdate

* Komplette Verwaltung von Kalender Rechte von internen und externen Mitarbeiteren
This commit is contained in:
Daniel Spitzer
2025-10-05 20:42:19 +02:00
parent 363dbd5436
commit e8acbb1082

View File

@@ -0,0 +1,83 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CalendarAddFields extends AbstractMigration
{
public function up(): void
{
if($this->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") {
}
}
}