migrations/Version20240618061019.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 Version20240618061019 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $entries = [
  18.             ['message_text' => '{PUBLIC_PROFILE_NAME} has posted something on his wall.''slug' => 'create-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  19.             ['message_text' => '{PUBLIC_PROFILE_NAME} has commented on your post. 123''slug' => 'comment-on-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  20.             ['message_text' => '{PUBLIC_PROFILE_NAME} has replied to your comment.''slug' => 'reply-on-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  21.             ['message_text' => '{PUBLIC_PROFILE_NAME} has liked your post.''slug' => 'like-on-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  22.             ['message_text' => '{PUBLIC_PROFILE_NAME} has liked your comment.''slug' => 'like-comment-reply''status' => '1''created_at' => '2024-06-18 16:34:51'],
  23.             ['message_text' => 'You are tagged by {PUBLIC_PROFILE_NAME} in a post.''slug' => 'tag-user''status' => '1''created_at' => '2024-06-18 16:34:51'],
  24.             ['message_text' => 'Your post has been deleted by the administrator.''slug' => 'post-deleted-by-admin''status' => '1''created_at' => '2024-06-18 16:34:51'],
  25.             ['message_text' => 'Your post has been edited by the administrator.''slug' => 'post-edited-by-admin''status' => '1''created_at' => '2024-06-18 16:34:51'],
  26.             ['message_text' => 'Your comment has been deleted by the administrator.''slug' => 'comment-deleted-by-admin''status' => '1''created_at' => '2024-06-18 16:34:51'],
  27.             ['message_text' => 'Your comment has been edited by the administrator.''slug' => 'comment-edited-by-admin''status' => '1''created_at' => '2024-06-18 16:34:51'],
  28.             ['message_text' => 'Your post has been blocked from commenting.''slug' => 'comment-blocked-on-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  29.             ['message_text' => '{PUBLIC_PROFILE_NAME} has made a comment on a post you are following.''slug' => 'comment-on-following-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  30.             ['message_text' => '{PUBLIC_PROFILE_NAME} has liked a post you are following.''slug' => 'like-on-following-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  31.             ['message_text' => 'Your {SUBSCRIPTION_TYPE} subscription will be renewed on {RNEWAL_DATE}''slug' => 'subscription-renewal-reminder''status' => '1''created_at' => '2024-06-18 16:34:51'],
  32.             ['message_text' => 'Your subscription has been successfully renewed.''slug' => 'subscription-renewal''status' => '1''created_at' => '2024-06-18 16:34:51'],
  33.             ['message_text' => 'You have cancelled your subscription.''slug' => 'subscription-cancellation''status' => '1''created_at' => '2024-06-18 16:34:51'],
  34.             ['message_text' => 'You have received a new message from {PUBLIC_PROFILE_NAME}.''slug' => 'direct-message''status' => '1''created_at' => '2024-06-18 16:34:51'],
  35.             ['message_text' => 'Your post has been un-blocked from commenting.''slug' => 'comment-unblocked-on-post''status' => '1''created_at' => '2024-06-18 16:34:51'],
  36.         ];
  37.         foreach ($entries as $entry) {
  38.             $existingEntry $this->connection->fetchAssociative(
  39.                 'SELECT * FROM notification_text WHERE slug = :slug',
  40.                 ['slug' => $entry['slug']]
  41.             );
  42.             if (!$existingEntry) {
  43.                 $this->addSql('INSERT INTO notification_text (message_text, slug , status,created_at) VALUES (:message_text, :slug, :status,CURRENT_TIMESTAMP)', [
  44.                     'message_text' => $entry['message_text'],
  45.                     'slug' => $entry['slug'],                    
  46.                     'status' => 1,
  47.                 ]);
  48.             }
  49.         }
  50.     }
  51.     public function down(Schema $schema): void
  52.     {
  53.         
  54.     }
  55. }