migrations/Version20240111040737.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 Version20240111040737 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' => 'Architect Registration',
  22.                 'slug' => 'architect-registration',
  23.                 'template' => 'architect-registration',
  24.                 'class' => null,
  25.                 'content' => 'Architect 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.                 'name' => 'Builder Registration',
  37.                 'slug' => 'builder-registration',
  38.                 'template' => 'builder-registration',
  39.                 'class' => null,
  40.                 'content' => 'Builder Registration'// Your content here
  41.                 'seo_title' => null,
  42.                 'seo_meta_keyword' => null,
  43.                 'seo_description' => null,
  44.                 'is_active' => 1,
  45.                 'deleted' => 1,
  46.                 'created_at' => '2023-11-30 13:16:32',
  47.                 'updated_at' => '2023-11-30 13:17:37',
  48.                 'deleted_at' => null,
  49.             ], 
  50.             [
  51.                 'name' => 'Showroom Registration',
  52.                 'slug' => 'showroom-registration',
  53.                 'template' => 'showroom-registration',
  54.                 'class' => null,
  55.                 'content' => 'Showroom Registration'// Your content here
  56.                 'seo_title' => null,
  57.                 'seo_meta_keyword' => null,
  58.                 'seo_description' => null,
  59.                 'is_active' => 1,
  60.                 'deleted' => 1,
  61.                 'created_at' => '2023-11-30 13:16:32',
  62.                 'updated_at' => '2023-11-30 13:17:37',
  63.                 'deleted_at' => null,
  64.             ], 
  65.                                
  66.             
  67.         ];
  68.         foreach ($recordsToInsert as $record) {
  69.             $slugExists $this->connection->fetchAssociative(
  70.                 'SELECT id FROM cms_pages WHERE slug = :slug',
  71.                 ['slug' => $record['slug']]
  72.             );
  73.     
  74.             
  75.             if ($slugExists === false) {
  76.                 $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);
  77.         }
  78.         }
  79.     }
  80.     public function down(Schema $schema): void
  81.     {
  82.         $recordsToRemove = [
  83.            
  84.             [
  85.                 'name' => 'Architect Registration',
  86.                 'slug' => 'architect-registration',
  87.                 'template' => 'architect-registration',
  88.                 'class' => null,
  89.                 'content' => 'Architect Registration'// Your content here
  90.                 'seo_title' => null,
  91.                 'seo_meta_keyword' => null,
  92.                 'seo_description' => null,
  93.                 'is_active' => 1,
  94.                 'deleted' => 1,
  95.                 'created_at' => '2023-11-30 13:16:32',
  96.                 'updated_at' => '2023-11-30 13:17:37',
  97.                 'deleted_at' => null,
  98.             ], 
  99.             [
  100.                 'name' => 'Builder Registration',
  101.                 'slug' => 'builder-registration',
  102.                 'template' => 'builder-registration',
  103.                 'class' => null,
  104.                 'content' => 'Builder Registration'// Your content here
  105.                 'seo_title' => null,
  106.                 'seo_meta_keyword' => null,
  107.                 'seo_description' => null,
  108.                 'is_active' => 1,
  109.                 'deleted' => 1,
  110.                 'created_at' => '2023-11-30 13:16:32',
  111.                 'updated_at' => '2023-11-30 13:17:37',
  112.                 'deleted_at' => null,
  113.             ], 
  114.             [
  115.                 'name' => 'Showroom Registration',
  116.                 'slug' => 'showroom-registration',
  117.                 'template' => 'showroom-registration',
  118.                 'class' => null,
  119.                 'content' => 'Showroom Registration'// Your content here
  120.                 'seo_title' => null,
  121.                 'seo_meta_keyword' => null,
  122.                 'seo_description' => null,
  123.                 'is_active' => 1,
  124.                 'deleted' => 1,
  125.                 'created_at' => '2023-11-30 13:16:32',
  126.                 'updated_at' => '2023-11-30 13:17:37',
  127.                 'deleted_at' => null,
  128.             ], 
  129.             
  130.            
  131.             
  132.         ];
  133.         foreach ($recordsToRemove as $slug) {
  134.             $this->addSql('DELETE FROM cms_pages WHERE slug = :slug', ['slug' => $slug]);
  135.         }       
  136.         
  137.     }
  138. }