migrations/Version20240117043252.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 Version20240117043252 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.             [
  21.                 'name' => 'Private Community Registration',
  22.                 'slug' => 'private-community-registration',
  23.                 'template' => 'private-community-registration',
  24.                 'class' => null,
  25.                 'content' => 'Private Community Registration'// Your content here
  26.                 'seo_title' => null,
  27.                 'seo_meta_keyword' => null,
  28.                 'seo_description' => null,
  29.                 'is_active' => 1,
  30.                 'deleted' => 1,
  31.                 'created_at' => '2023-11-30 13:16:32',
  32.                 'updated_at' => '2023-11-30 13:17:37',
  33.                 'deleted_at' => null,
  34.             ],     
  35.                            
  36.         ];
  37.         foreach ($recordsToInsert as $record) {
  38.             $slugExists $this->connection->fetchAssociative(
  39.                 'SELECT id FROM cms_pages WHERE slug = :slug',
  40.                 ['slug' => $record['slug']]
  41.             );
  42.     
  43.             
  44.             if ($slugExists === false) {
  45.                 $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);
  46.             }
  47.         }
  48.        
  49.     }
  50.     public function down(Schema $schema): void
  51.     {
  52.         
  53.     }
  54. }