Files
thetool/db/migrations/20240130120101_contract_add_reseller_id.php
2024-12-22 15:58:19 +01:00

53 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ContractAddResellerId extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contract");
$table->addColumn("crediting_partner_id", "integer", ["null" => true, "default" => null, "after" => "orderproduct_id"]);
$table->addColumn("crediting_partner_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "crediting_partner_id"]);
$table->addColumn("reseller_id", "integer", ["null" => true, "default" => null, "after" => "crediting_partner_rate"]);
$table->addColumn("reseller_rate", "decimal", ["null" => true, "default" => null, "precision" => 10, "scale" => 4, "after" => "reseller_id"]);
$table->addIndex("orderproduct_id");
$table->update();
$table = $this->table("Contractqueue");
$table->addIndex("order_id");
$table->addIndex("orderproduct_id");
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contractqueue");
$table->removeIndex("orderproduct_id");
$table->removeIndex("order_id");
$table->update();
$table = $this->table("Contract");
$table->removeIndex("orderproduct_id");
$table->removeColumn("reseller_rate");
$table->removeColumn("reseller_id");
$table->removeColumn("crediting_partner_rate");
$table->removeColumn("crediting_partner_id");
$table->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}