Files
thetool/db/migrations/20250804150000_warehouse_add_all_create_cols.php
2025-08-04 15:28:12 +02:00

72 lines
3.2 KiB
PHP

<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class WarehouseAddAllCreateCols extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$this->execute("ALTER TABLE `WarehouseArticle` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseArticleDistributor` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseArticlePacket` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseArticlePrice` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseDistributor` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseEShopOrderItem` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseLocationThresholdOverride` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseOfferTemplate` ADD COLUMN `create` int(11) DEFAULT 1754312555, ADD COLUMN `createBy` int(11) DEFAULT 1;");
$this->execute("ALTER TABLE `WarehouseCategory` ADD `articleNumberPrefix` int NULL AFTER `description`;");
}
}
public function down(): void
{
if ($this->getEnvironment() == "thetool") {
$table = $this->table('WarehouseArticle');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseArticleDistributor');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseArticlePacket');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseArticlePrice');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseDistributor');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseEShopOrderItem');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseLocationThresholdOverride');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseOfferTemplate');
$table->removeColumn('create')
->removeColumn('createBy')
->save();
$table = $this->table('WarehouseCategory');
$table->removeColumn('articleNumberPrefix')
->save();
}
}
}