migrations/Version20240219085835.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240219085835 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $recordsToInsert = [
  19.             [
  20.                 'name' => 'Resource Directory Sourcing',
  21.                 'slug' => 'resource_directory_sourcing',
  22.                 'template' => 'resource_directory_sourcing',
  23.                 'class' => null,
  24.                 'content' => 'Resource Directory Sourcing'// Your content here
  25.                 'seo_title' => null,
  26.                 'seo_meta_keyword' => null,
  27.                 'seo_description' => null,
  28.                 'is_active' => 1,
  29.                 'deleted' => 1,
  30.                 'created_at' => '2023-11-30 13:16:32',
  31.                 'updated_at' => '2023-11-30 13:17:37',
  32.                 'deleted_at' => null,
  33.             ], 
  34.             [
  35.                 'name' => 'Supplier List Sourcing',
  36.                 'slug' => 'supplier_list_sourcing',
  37.                 'template' => 'supplier_list_sourcing',
  38.                 'class' => null,
  39.                 'content' => 'Supplier List Sourcing'// Your content here
  40.                 'seo_title' => null,
  41.                 'seo_meta_keyword' => null,
  42.                 'seo_description' => null,
  43.                 'is_active' => 1,
  44.                 'deleted' => 1,
  45.                 'created_at' => '2023-11-30 13:16:32',
  46.                 'updated_at' => '2023-11-30 13:17:37',
  47.                 'deleted_at' => null,
  48.             ], 
  49.             [
  50.                 'name' => 'Purchasig Group Sourcing',
  51.                 'slug' => 'purchasing_group_sourcing',
  52.                 'template' => 'purchasing_group_sourcing',
  53.                 'class' => null,
  54.                 'content' => 'Purchasig Group Sourcing'// Your content here
  55.                 'seo_title' => null,
  56.                 'seo_meta_keyword' => null,
  57.                 'seo_description' => null,
  58.                 'is_active' => 1,
  59.                 'deleted' => 1,
  60.                 'created_at' => '2023-11-30 13:16:32',
  61.                 'updated_at' => '2023-11-30 13:17:37',
  62.                 'deleted_at' => null,
  63.             ]
  64.             
  65.             
  66.         ];
  67.         foreach ($recordsToInsert as $record) {
  68.             $slugExists $this->connection->fetchAssociative(
  69.                 'SELECT id FROM cms_pages WHERE slug = :slug',
  70.                 ['slug' => $record['slug']]
  71.             );
  72.     
  73.             
  74.             if ($slugExists === false) {
  75.                 $this->addSql('INSERT INTO cms_pages (name, slug, template, class, content, seo_title, seo_meta_keyword, seo_description, is_active, deleted, created_at, updated_at, deleted_at) VALUES (:name, :slug, :template, :class, :content, :seo_title, :seo_meta_keyword, :seo_description, :is_active, :deleted, :created_at, :updated_at, :deleted_at)'$record);
  76.             }
  77.         }
  78.     }
  79.     public function down(Schema $schema): void
  80.     {
  81.         // this down() migration is auto-generated, please modify it to your needs
  82.        
  83.     }
  84. }