Files
thetool/db/migrations/20250317133633_preorder_history_add_changed.php
2025-03-18 02:10:53 +01:00

39 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class PreorderHistoryAddChanged extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table('PreorderHistory');
$table->addColumn('changed', 'integer', ["null" => true, "after" => "new_value"]);
$table->update();
$builder = $this->getQueryBuilder();
$q = $builder->select("*")->from("PreorderHistory")->execute();
$this->query("UPDATE PreorderHistory SET `changed` = `create`");
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table('PreorderHistory');
$table->removeColumn('changed');
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}