33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?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();
|
|
}
|
|
}
|
|
}
|