migrations/Version20231130071813.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 Version20231130071813 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' => 'Login',
  21.                 'slug' => 'login',
  22.                 'template' => 'login',
  23.                 'class' => null,
  24.                 'content' => 'Login'// 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' => 'Home Owner Register',
  36.                 'slug' => 'home-owner-register',
  37.                 'template' => 'home-owner-register',
  38.                 'class' => null,
  39.                 'content' => 'Home Owner Register'// 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' => 'Education',
  51.                 'slug' => 'education',
  52.                 'template' => 'education',
  53.                 'class' => null,
  54.                 'content' => 'Education'// 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.                 'name' => 'Directory Profile',
  66.                 'slug' => 'directory_profile',
  67.                 'template' => 'directory_profile',
  68.                 'class' => null,
  69.                 'content' => 'Directory Profile'// 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-11-30 13:16:32',
  76.                 'updated_at' => '2023-11-30 13:17:37',
  77.                 'deleted_at' => null,
  78.             ],                    
  79.             
  80.         ];
  81.         foreach ($recordsToInsert as $record) {
  82.             $slugExists $this->connection->fetchAssociative(
  83.                 'SELECT id FROM cms_pages WHERE slug = :slug',
  84.                 ['slug' => $record['slug']]
  85.             );
  86.     
  87.             
  88.             if ($slugExists === false) {
  89.                 $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);
  90.             }
  91.         }
  92.     }
  93.     public function down(Schema $schema): void
  94.     {
  95.         $recordsToRemove = [
  96.             [   
  97.                 'name' => 'Login',
  98.                 'slug' => 'login',
  99.                 'template' => 'login',
  100.                 'class' => null,
  101.                 'content' => '<h1 style=\"box-sizing: border-box; margin: 0px 0px 28px; font-weight: 700; line-height: 64px; font-size: 57px; padding: 0px; width: 800px; color: rgb(0, 0, 0); font-family: GeorgiaBold; outline: none !important;\">Login</h1>\r\n\r\n<p><span style=\"box-sizing: border-box; display: block; margin-bottom: 32px; color: rgb(99, 115, 129); font-size: 22px; line-height: 32px; font-family: Roboto, sans-serif; outline: none !important;\">Effective Date: January 1, 2022.</span></p>\r\n\r\n<p style=\"box-sizing: border-box; margin: 0px 0px 32px; padding: 0px; width: 800px; color: rgb(99, 115, 129); font-size: 22px; line-height: 32px; font-family: Roboto, sans-serif; outline: none !important;\">Login</p>'// Your content here
  102.                 'seo_title' => null,
  103.                 'seo_meta_keyword' => null,
  104.                 'seo_description' => null,
  105.                 'is_active' => 1,
  106.                 'deleted' => 1,
  107.                 'created_at' => '2023-11-30 13:16:32',
  108.                 'updated_at' => '2023-11-30 13:17:37',
  109.                 'deleted_at' => null,
  110.             ],
  111.             [
  112.                 'name' => 'Register',
  113.                 'slug' => 'register',
  114.                 'template' => 'register',
  115.                 'class' => null,
  116.                 'content' => 'Register'// Your content here
  117.                 'seo_title' => null,
  118.                 'seo_meta_keyword' => null,
  119.                 'seo_description' => null,
  120.                 'is_active' => 1,
  121.                 'deleted' => 1,
  122.                 'created_at' => '2023-11-30 13:16:32',
  123.                 'updated_at' => '2023-11-30 13:17:37',
  124.                 'deleted_at' => null,
  125.             ], 
  126.             [
  127.                 'name' => 'Education',
  128.                 'slug' => 'education',
  129.                 'template' => 'education',
  130.                 'class' => null,
  131.                 'content' => 'Education'// Your content here
  132.                 'seo_title' => null,
  133.                 'seo_meta_keyword' => null,
  134.                 'seo_description' => null,
  135.                 'is_active' => 1,
  136.                 'deleted' => 1,
  137.                 'created_at' => '2023-11-30 13:16:32',
  138.                 'updated_at' => '2023-11-30 13:17:37',
  139.                 'deleted_at' => null,
  140.             ],     
  141.             [
  142.                 'name' => 'Directory Profile',
  143.                 'slug' => 'directory_profile',
  144.                 'template' => 'directory_profile',
  145.                 'class' => null,
  146.                 'content' => 'Directory Profile'// Your content here
  147.                 'seo_title' => null,
  148.                 'seo_meta_keyword' => null,
  149.                 'seo_description' => null,
  150.                 'is_active' => 1,
  151.                 'deleted' => 1,
  152.                 'created_at' => '2023-11-30 13:16:32',
  153.                 'updated_at' => '2023-11-30 13:17:37',
  154.                 'deleted_at' => null,
  155.             ],      
  156.            
  157.             
  158.         ];
  159.         foreach ($recordsToRemove as $slug) {
  160.             $this->addSql('DELETE FROM cms_pages WHERE slug = :slug', ['slug' => $slug]);
  161.         }       
  162.         
  163.     }
  164. }