migrations/Version20240618061019.php line 1

Open in your IDE?
  1. <?php
    
    declare(strict_types=1);
    
    namespace DoctrineMigrations;
    
    use Doctrine\DBAL\Schema\Schema;
    use Doctrine\Migrations\AbstractMigration;
    
    /**
     * Auto-generated Migration: Please modify to your needs!
     */
    final class Version20240618061019 extends AbstractMigration
    {
        public function getDescription(): string
        {
            return '';
        }
    
        public function up(Schema $schema): void
        {
    
            $entries = [
                ['message_text' => '{PUBLIC_PROFILE_NAME} has posted something on his wall.', 'slug' => 'create-post', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['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'],
                ['message_text' => '{PUBLIC_PROFILE_NAME} has replied to your comment.', 'slug' => 'reply-on-post', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['message_text' => '{PUBLIC_PROFILE_NAME} has liked your post.', 'slug' => 'like-on-post', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['message_text' => '{PUBLIC_PROFILE_NAME} has liked your comment.', 'slug' => 'like-comment-reply', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['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'],
                ['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'],
                ['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'],
                ['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'],
                ['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'],
                ['message_text' => 'Your post has been blocked from commenting.', 'slug' => 'comment-blocked-on-post', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['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'],
                ['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'],
                ['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'],
                ['message_text' => 'Your subscription has been successfully renewed.', 'slug' => 'subscription-renewal', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['message_text' => 'You have cancelled your subscription.', 'slug' => 'subscription-cancellation', 'status' => '1', 'created_at' => '2024-06-18 16:34:51'],
                ['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'],
                ['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'],
    
            ];
            foreach ($entries as $entry) {
                $existingEntry = $this->connection->fetchAssociative(
                    'SELECT * FROM notification_text WHERE slug = :slug',
                    ['slug' => $entry['slug']]
                );
                if (!$existingEntry) {
                    $this->addSql('INSERT INTO notification_text (message_text, slug , status,created_at) VALUES (:message_text, :slug, :status,CURRENT_TIMESTAMP)', [
                        'message_text' => $entry['message_text'],
                        'slug' => $entry['slug'],                    
                        'status' => 1,
                    ]);
                }
            }
        }
        public function down(Schema $schema): void
        {
            
        }
    }