<?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 Version20241025111140 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE `tc_production_settings_activity_log` (
`id` int NOT NULL AUTO_INCREMENT,
`company_id` int NOT NULL,
`user_id` int NOT NULL,
`action` varchar(255) NOT NULL,
`from_data` mediumtext,
`to_data` mediumtext,
`done_at` datetime NOT NULL,
`done_by` int NOT NULL,
PRIMARY KEY (`id`),
KEY `comapny_id` (`company_id`),
KEY `user_id` (`user_id`),
KEY `done_by` (`done_by`),
CONSTRAINT `tc_production_settings_activity_log_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `tc_production_settings_activity_log_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `tc_production_settings_activity_log_ibfk_3` FOREIGN KEY (`done_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci");
$this->addSql("INSERT INTO `tc_user_roles` (`id`, `role_key`, `category`, `role`, `is_active`, `is_readonly`, `is_deleted`) VALUES (NULL, 'ROLE_PRODUCTION_SETTINGS', 'PRODUCTION_PLAN', 'PRODUCTION_SETTINGS', '1', '0', '0');");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS `tc_production_settings_activity_log`");
$this->addSql("DELETE FROM `tc_user_roles` WHERE `role_key` = 'ROLE_PRODUCTION_SETTINGS' AND `category` = 'PRODUCTION_PLAN' AND `role` = 'PRODUCTION_SETTINGS';");
}
}