MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/lead_cafsinfotech.com/core/backend/Migrations/Version20241001074858.php
<?php

declare(strict_types=1);

namespace App\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20241001074858 extends BaseMigration implements ContainerAwareInterface
{
    public function getDescription(): string
    {
        return 'Add Totp Secret Field to DB';
    }

    public function up(Schema $schema): void
    {
        /** @var EntityManagerInterface $entityManager */
        $entityManager = $this->container->get('entity_manager');

        try {
            $entityManager->getConnection()->executeQuery('ALTER TABLE users ADD COLUMN `totp_secret` varchar(255) NULL');
        } catch (\Exception $e) {
            $this->log('Failed to add column totp_secret to users. Error: ' . $e->getMessage());
        }

        try {
            $entityManager->getConnection()->executeQuery('ALTER TABLE users ADD COLUMN `is_totp_enabled` tinyint(1) NULL');
        } catch (\Exception $e) {
            $this->log('Failed to add column is_totp_enabled to users. Error: ' . $e->getMessage());
        }

        try {
            $entityManager->getConnection()->executeQuery('ALTER TABLE users ADD COLUMN `backup_codes` text NULL');
        } catch (\Exception $e) {
            $this->log('Failed to add column $backupCodes to users. Error: ' . $e->getMessage());
        }

    }

    public function down(Schema $schema): void
    {
    }
}