migrations/Version20231211054931.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 Version20231211054931 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' => 'Contact Us',
  21.                 'slug' => 'contact_us',
  22.                 'template' => 'contact_us',
  23.                 'class' => null,
  24.                 'content' => 'Contact Us'// 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-11 13:16:32',
  31.                 'updated_at' => '2023-12-11 13:17:37',
  32.                 'deleted_at' => null,
  33.             ],
  34.             [
  35.                 'name' => 'Trade Program',
  36.                 'slug' => 'trade_program',
  37.                 'template' => 'trade_program',
  38.                 'class' => null,
  39.                 'content' => 'Trade Program'// 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-12-11 13:16:32',
  46.                 'updated_at' => '2023-12-11 13:17:37',
  47.                 'deleted_at' => null,
  48.             ],
  49.             [
  50.                 'name' => 'Memo Landing',
  51.                 'slug' => 'memo_landing',
  52.                 'template' => 'memo_landing',
  53.                 'class' => null,
  54.                 'content' => 'Memo Landing'// 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-12-11 13:16:32',
  61.                 'updated_at' => '2023-12-11 13:17:37',
  62.                 'deleted_at' => null,
  63.             ],
  64.             [
  65.                 'name' => 'Podcast Landing',
  66.                 'slug' => 'podcast_landing',
  67.                 'template' => 'podcast_landing',
  68.                 'class' => null,
  69.                 'content' => 'Podcast Landing'// Your content here
  70.                 'seo_title' => null,
  71.                 'seo_meta_keyword' => null,
  72.                 'seo_description' => null,
  73.                 'is_active' => 1,
  74.                 'deleted' => 1,
  75.                 'created_at' => '2023-12-11 13:16:32',
  76.                 'updated_at' => '2023-12-11 13:17:37',
  77.                 'deleted_at' => null,
  78.             ],
  79.             [
  80.                 'name' => 'Resource Directory Landing',
  81.                 'slug' => 'resource_directory_landing',
  82.                 'template' => 'resource_directory_landing',
  83.                 'class' => null,
  84.                 'content' => 'Resource Directory Landing'// Your content here
  85.                 'seo_title' => null,
  86.                 'seo_meta_keyword' => null,
  87.                 'seo_description' => null,
  88.                 'is_active' => 1,
  89.                 'deleted' => 1,
  90.                 'created_at' => '2023-12-11 13:16:32',
  91.                 'updated_at' => '2023-12-11 13:17:37',
  92.                 'deleted_at' => null,
  93.             ],
  94.             [
  95.                 'name' => 'Collaboration Landing',
  96.                 'slug' => 'community_feed_landing',
  97.                 'template' => 'community_feed_landing',
  98.                 'class' => null,
  99.                 'content' => 'Collaboration Landing'// Your content here
  100.                 'seo_title' => null,
  101.                 'seo_meta_keyword' => null,
  102.                 'seo_description' => null,
  103.                 'is_active' => 1,
  104.                 'deleted' => 1,
  105.                 'created_at' => '2023-12-11 13:16:32',
  106.                 'updated_at' => '2023-12-11 13:17:37',
  107.                 'deleted_at' => null,
  108.             ],
  109.         ];
  110.         foreach ($recordsToInsert as $record) {
  111.             $slugExists $this->connection->fetchAssociative(
  112.                 'SELECT id FROM cms_pages WHERE slug = :slug',
  113.                 ['slug' => $record['slug']]
  114.             );
  115.             if ($slugExists === false) {
  116.                 $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);
  117.             }
  118.         }
  119.     }
  120.     public function down(Schema $schema): void
  121.     {
  122.     }
  123. }