<?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 Version20240219074039 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$entries = [
['title' => 'Download', 'slug' => 'admin_user_ads_data_download', 'route' => 'user-ads-data/index/download/', 'group' => 'User Ads Data', 'desc' => 'description', 'status' => '1'],
['title' => 'Download', 'slug' => 'admin_media_kit_permission', 'route' => 'media-kit/index/download/*', 'group' => 'Media Kit ', 'desc' => 'description', 'status' => '1'],
['title' => 'Show Password', 'slug' => 'admin_media_kit_show_password', 'route' => 'media-kit/index/showPassword/*', 'group' => 'Media Kit ', 'desc' => 'description', 'status' => '1'],
];
foreach ($entries as $entry) {
$existingEntry = $this->connection->fetchAssociative(
'SELECT * FROM permissions WHERE permission_slug = :slug',
['slug' => $entry['slug']]
);
if (!$existingEntry) {
$this->addSql('INSERT INTO permissions (permission_title, permission_slug , permission_route,permission_group,permission_description,status,created_at) VALUES (:title, :slug, :route, :group,:desc,:status,CURRENT_TIMESTAMP)', [
'title' => $entry['title'],
'slug' => $entry['slug'],
'route' => $entry['route'],
'group' => $entry['group'],
'desc' => $entry['desc'],
'status' => 1,
]);
}
}
$this->addSql('UPDATE `permissions` SET `permission_slug` = "admin_resource_types_add" WHERE `permissions`.`permission_route` = "resource-types/index/add/"');
$this->addSql('UPDATE `permissions` SET `permission_slug` = "admin_resource_types_edit" WHERE `permissions`.`permission_route` = "resource-types/index/edit/"');
$this->addSql('UPDATE `permissions` SET `permission_slug` = "admin_resource_types_delete" WHERE `permissions`.`permission_route` = "resource-types/index/delete/"');
$this->addSql('UPDATE `permissions` SET `permission_slug` = "admin_rating_criteria_listing" WHERE `permissions`.`permission_route` = "rating-criteria"');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}