Zeiterfassung neues Feature:

* Migrations für PRjoect
This commit is contained in:
Daniel Spitzer
2025-03-08 09:21:53 +01:00
parent 5ddca45820
commit 6deca44063
3 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
use Phinx\Migration\AbstractMigration;
final class TimerecordingCarJournal extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$table = $this->table("TimerecordingCarJournal", ["signed" => true]);
$table->addColumn("TimerecordingCar_id", "integer", ["null" => true]);
$table->addColumn("journal", "text", ["null" => false]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if ($this->getEnvironment() == "thetool") {
$this->table("TimerecordingCarJournal")->drop()->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
}
?>

View File

@@ -0,0 +1,36 @@
<?php
use Phinx\Migration\AbstractMigration;
final class TimerecordingCarMileageHistory extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$table = $this->table("TimerecordingCarMileageHistory", ["signed" => true]);
$table->addColumn("TimerecordingCar_id", "integer", ["null" => true]);
$table->addColumn("mileage", "integer", ["null" => false]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if ($this->getEnvironment() == "thetool") {
$this->table("TimerecordingCarMileageHistory")->drop()->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class TimerecordingCarAddFieldOverrideApproval extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("TimerecordingCar", ["signed" => true]);
$table->addColumn("type", "integer", ["null" => true, "default" => 1, "after" => "user_id"]);
$table->addColumn("override_approval", "integer", ["null" => true, "default" => NULL, "after" => "initial_approval"]);
$table->addColumn("retired", "integer", ["null" => true, "default" => NULL, "after" => "timerecording"]);
$table->addColumn("retired_date", "integer", ["null" => true, "default" => NULL, "after" => "retired"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("TimerecordingCar")->removeColumn("override_approval")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}