Kalenderupdate
* Komplette Verwaltung von Kalender Rechte von internen und externen Mitarbeiteren
This commit is contained in:
83
db/migrations/20251005183109_calendar_add_fields.php
Normal file
83
db/migrations/20251005183109_calendar_add_fields.php
Normal 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") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user