From aff469924ec5094fc9309b20d81f35d4bb9e59fb Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Sun, 22 Dec 2024 15:58:19 +0100 Subject: [PATCH] Fixed db migrations --- .../20231219144324_poprackmodulepatch.php | 6 ++-- ...0240130120101_contract_add_reseller_id.php | 9 ------ ...oduct_order_contract_add_contract_term.php | 5 --- db/schema/thetool.init.sql | 32 ------------------- scripts/address-update-country_id.php | 2 +- 5 files changed, 5 insertions(+), 49 deletions(-) diff --git a/db/migrations/20231219144324_poprackmodulepatch.php b/db/migrations/20231219144324_poprackmodulepatch.php index 3d0a9c74b..10835cb09 100644 --- a/db/migrations/20231219144324_poprackmodulepatch.php +++ b/db/migrations/20231219144324_poprackmodulepatch.php @@ -8,8 +8,10 @@ final class Poprackmodulepatch extends AbstractMigration public function up(): void { if($this->getEnvironment() == "thetool") { + // on error make poprackmodule.id signed + $poprackmodulepatch = $this->table("Poprackmodulepatch", ['signed' => true]); - $poprackmodulepatch->addColumn("poprackmodule_id", "integer", ["null" => false]); + $poprackmodulepatch->addColumn("poprackmodule_id", "integer", ["null" => false, "signed" => false])->addIndex("poprackmodule_id"); $poprackmodulepatch->addColumn("port", "integer", ["null" => false])->addIndex(['port']); $poprackmodulepatch->addColumn("fiberPlanCable_id", "integer", ["null" => true, "default" => null])->addIndex(['fiberPlanCable_id']); $poprackmodulepatch->addColumn("destination", "integer", ["null" => true, "default" => null, "comment" => "1:startpoint/2:endpoint"]); @@ -19,7 +21,7 @@ final class Poprackmodulepatch extends AbstractMigration $poprackmodulepatch->addColumn("edit", "integer", ["null" => false]); $poprackmodulepatch->save(); $poprackmodulepatch = $this->table("Poprackmodulepatch"); - $poprackmodulepatch->addForeignKey('poprackmodule_id', 'Poprackmodule', ['id'],['delete'=> 'CASCADE', 'update'=> 'RESTRICT','constraint' => 'poprackmodule_id']); + $poprackmodulepatch->addForeignKey('poprackmodule_id', 'Poprackmodule', 'id',['delete'=> 'CASCADE', 'update'=> 'RESTRICT','constraint' => 'poprackmodule_id']); $poprackmodulepatch->save(); } diff --git a/db/migrations/20240130120101_contract_add_reseller_id.php b/db/migrations/20240130120101_contract_add_reseller_id.php index c4d16e9c3..ee250bead 100644 --- a/db/migrations/20240130120101_contract_add_reseller_id.php +++ b/db/migrations/20240130120101_contract_add_reseller_id.php @@ -17,11 +17,6 @@ final class ContractAddResellerId extends AbstractMigration $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(); @@ -38,10 +33,6 @@ final class ContractAddResellerId extends AbstractMigration $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"); diff --git a/db/migrations/20240206182217_product_order_contract_add_contract_term.php b/db/migrations/20240206182217_product_order_contract_add_contract_term.php index 30967ef22..fa0798c67 100644 --- a/db/migrations/20240206182217_product_order_contract_add_contract_term.php +++ b/db/migrations/20240206182217_product_order_contract_add_contract_term.php @@ -20,10 +20,6 @@ final class ProductOrderContractAddContractTerm extends AbstractMigration $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") { @@ -34,7 +30,6 @@ final class ProductOrderContractAddContractTerm extends AbstractMigration 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(); diff --git a/db/schema/thetool.init.sql b/db/schema/thetool.init.sql index 788e82e6e..4e8956f36 100644 --- a/db/schema/thetool.init.sql +++ b/db/schema/thetool.init.sql @@ -1786,38 +1786,6 @@ INSERT INTO `Terminationstatus` VALUES (1,10,'created',1,1,1626988046,1626988046 /*!40000 ALTER TABLE `Terminationstatus` ENABLE KEYS */; UNLOCK TABLES; --- --- Table structure for table `Voicenumberblock` --- - -DROP TABLE IF EXISTS `Voicenumberblock`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `Voicenumberblock` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL, - `countrycode` int NOT NULL, - `areacode` int NOT NULL, - `first` int NOT NULL, - `last` int NOT NULL, - `number_prepend_zero` tinyint NOT NULL COMMENT 'is 1 if number part starts with zero (i.e. 43 123 0123456)', - `comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, - `create_by` int NOT NULL, - `create` int NOT NULL, - `edit_by` int NOT NULL, - `edit` int NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `Voicenumberblock` --- - -LOCK TABLES `Voicenumberblock` WRITE; -/*!40000 ALTER TABLE `Voicenumberblock` DISABLE KEYS */; -/*!40000 ALTER TABLE `Voicenumberblock` ENABLE KEYS */; -UNLOCK TABLES; -- -- Table structure for table `Worker` diff --git a/scripts/address-update-country_id.php b/scripts/address-update-country_id.php index c94c7230b..ae7b4f72c 100755 --- a/scripts/address-update-country_id.php +++ b/scripts/address-update-country_id.php @@ -29,7 +29,7 @@ foreach(AddressModel::getAll() as $address) { $c = strtolower(trim($address->country)); - if(!$c || $c == "österreich" || $c == "Österreich" || $c == "Österreic" || $c == "Österreicch" || $c == "Österrreich" || $c == "at" || $c == "a") { + if(!$c || $c == "österreich" || $c == "Österreich" || $c == "Österreic" || $c == "Österreicch" || $c == "Österrreich" || $c == "at" || $c == "a" || $c == "ö") { $country = $austria; }