Feature/preorder add history

This commit is contained in:
Luca Haid
2024-07-17 13:34:22 +00:00
committed by Frank Schubert
parent 076b513039
commit 04153eb8d3
6 changed files with 332 additions and 2 deletions
@@ -0,0 +1,32 @@
<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddPreorderHistory extends AbstractMigration {
public function up(): void {
if ($this->getEnvironment() == "thetool") {
$preorderHistoryTable = $this->table("PreorderHistory", ["signed" => true]);
$preorderHistoryTable
->addColumn("preorder_id", "integer", ["null" => false, "signed" => true])
->addColumn("key", "string", ["null" => false, "limit" => 100])
->addColumn("old_value", "text", ["null" => true])
->addColumn("new_value", "text", ["null" => true])
->addColumn("create_by", "integer", ["null" => false])
->addColumn("edit_by", "integer", ["null" => false])
->addColumn("create", "integer", ["null" => false])
->addColumn("edit", "integer", ["null" => false]);
$preorderHistoryTable->addForeignKey("preorder_id", "Preorder", "id", ["delete" => "CASCADE", "update" => "NO_ACTION"]);
$preorderHistoryTable->create();
}
}
public function down(): void {
if ($this->getEnvironment() == "thetool") {
$this->table("PreorderHistory")->drop()->save();
}
}
}