<?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 Version20240304042926 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' => 'Listing',
'slug' => 'app_supplier_type',
'route' => '/supplier-type/index',
'group' => 'Supplier Types',
'desc' => 'description',
'status' => '1'
],
[
'title' => 'Add',
'slug' => 'app_supplier_type_add',
'route' => '/supplier-type/create',
'group' => 'Supplier Types',
'desc' => 'description',
'status' => '1'
],
[
'title' => 'Edit',
'slug' => 'app_supplier_type_edit',
'route' => '/supplier-type/edit/*',
'group' => 'Supplier Types',
'desc' => 'description',
'status' => '1'
],
[
'title' => 'Delete',
'slug' => 'app_supplier_type_delete',
'route' => '/supplier-type/delete/*',
'group' => 'Supplier Types',
'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,
]);
}
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}