<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240902073249 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE `tc_imports` ADD `scheduled_status` ENUM('pending','success','deleted') NULL AFTER `validation_status`");
$this->addSql("ALTER TABLE `tc_product_activity_log` CHANGE `from_data` `from_data` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL");
$this->addSql("ALTER TABLE `tc_product_activity_log` CHANGE `to_data` `to_data` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL");
$this->addSql("CREATE TABLE company_notification_settings (
id int NOT NULL AUTO_INCREMENT,
company_id int NOT NULL,
notification_type enum('shipping_due_date') DEFAULT NULL,
notify_date int DEFAULT NULL,
created_at datetime NOT NULL,
PRIMARY KEY (id),
KEY company_id (company_id),
CONSTRAINT company_notification_settings_ibfk_1 FOREIGN KEY (company_id) REFERENCES company (id) ON DELETE RESTRICT ON UPDATE RESTRICT
)");
$this->addSql("ALTER TABLE `company_settings` ADD `workorder_buffer` FLOAT NULL AFTER `card_refid_starts_from`, ADD `level_margin` INT NULL AFTER `workorder_buffer`");
$this->addSql("UPDATE `company_settings` SET `level_margin` = '1' ,`workorder_buffer` = '0' WHERE `id` = 1");
$this->addSql("ALTER TABLE `dp_workorder` ADD `buffer_jit_call_quantity` INT NULL AFTER `import_id`");
}
public function down(Schema $schema): void
{
$this->addSql("ALTER TABLE `dp_workorder` DROP COLUMN `buffer_jit_call_quantity`");
$this->addSql('ALTER TABLE company_settings DROP COLUMN workorder_buffer, DROP COLUMN level_margin');
$this->addSql("ALTER TABLE `tc_imports` DROP COLUMN `scheduled_status`");
$this->addSql("ALTER TABLE `tc_product_activity_log` CHANGE `from_data` `from_data` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL");
$this->addSql("ALTER TABLE `tc_product_activity_log` CHANGE `to_data` `to_data` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL");
$this->addSql("DROP TABLE IF EXISTS `company_notification_settings`");
}
}