migrations/Version20231222092159.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 Version20231222092159 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // To insert cms pages//
  18.         $recordsToInsert = [
  19.             [
  20.                 'name' => 'Private Community Application',
  21.                 'slug' => 'private_community_application',
  22.                 'template' => 'private_community_application',
  23.                 'class' => null,
  24.                 'content' => 'Private Community Application'// 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-12-22 13:16:32',
  31.                 'updated_at' => '2023-12-22 13:17:37',
  32.                 'deleted_at' => null,
  33.             ],             
  34.         ];
  35.             foreach ($recordsToInsert as $record) {
  36.                 $slugExists $this->connection->fetchAssociative(
  37.                     'SELECT id FROM cms_pages WHERE slug = :slug',
  38.                     ['slug' => $record['slug']]
  39.                 );
  40.                 if ($slugExists === false) {
  41.                     $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);
  42.                 }
  43.             }
  44.     }
  45.     public function down(Schema $schema): void
  46.     {
  47.         
  48.     }
  49. }