Added sepa date

This commit is contained in:
Frank Schubert
2024-02-06 20:47:44 +01:00
parent e9937f2df8
commit 38ec49ddb3
10 changed files with 309 additions and 1 deletions
@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateContractqueue extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contractqueue");
$table->addColumn("approved", "integer", ["null" => false, "default" => 0]);
$table->addColumn("contract_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("order_id", "integer", ["null" => false]);
$table->addColumn("orderproduct_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("owner_id", "integer", ["null" => false]);
$table->addColumn("billingaddress_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("termination_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_name", "string", ["null" => false, "limit" => 255]);
$table->addColumn("product_info", "text", ["null" => true, "default" => null]);
$table->addColumn("matchcode", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("amount", "decimal", ["null" => false, "precision" => 9, "scale" => 6]);
$table->addColumn("sla_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("product_external", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
$table->addColumn("product_external_id", "integer", ["null" => true, "default" => null]);
$table->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
$table->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("price_nne", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("price_nbe", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
$table->addColumn("billing_delay", "integer", ["null" => false, "default" => 0]);
$table->addColumn("billing_period", "integer", ["null" => false, "default" => 1]);
$table->addColumn("order_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("finish_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("finish_date_by", "integer", ["null" => true, "default" => null]);
$table->addColumn("cancel_date", "integer", ["null" => true, "default" => null]);
$table->addColumn("cancel_date_by", "integer", ["null" => true, "default" => null]);
$table->addColumn("imported_from", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("imported_data", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("note", "text", ["null" => true, "default" => null]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->create();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Contractqueue")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddressAddSepaDate extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Address");
$table->addColumn("sepa_date", "integer", ["null" => true, "default" => null, "after" => "bank_account_bic"]);
$table->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Address")->removeColumn("sepa_date")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}
@@ -0,0 +1,61 @@
<?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->addColumn("approved_credit", "integer", ["null" => false, "default" => 0, "after" => "approved"]);
$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("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->removeColumn("reseller_rate");
$table->removeColumn("reseller_id");
$table->removeColumn("crediting_partner_rate");
$table->removeColumn("crediting_partner_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") {
}
}
}
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ContractLinkAddTypeCredit extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ContractLink");
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange,credit"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ContractLink");
$table->changeColumn("type", "enum", ["null" => false, "values" => "link,upgrade,downgrade,relocation,productchange"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class OrderChangeOrderdateDefaultNull extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Order");
$table->changeColumn("order_date", "integer", ["null" => true, "default" => null]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
}
}
}
@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ProductOrderContractAddContractTerm extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Product");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("OrderProduct");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("Contract");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
$table = $this->table("Contractqueue");
$table->addColumn("contract_term", "integer", ["null" => false, "default" => 12, "after" => "billing_period"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Contractqueue")->removeColumn("contract_term")->update();
$this->table("Contract")->removeColumn("contract_term")->update();
$this->table("OrderProduct")->removeColumn("contract_term")->update();
$this->table("Product")->removeColumn("contract_term")->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}