<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use App\Utils\SettingsHelper;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20230907043830 extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        $settHelper = new SettingsHelper();
        $settings = $settHelper->getAll();
        foreach ($settings as $sett) {
            $type = $sett->type;
            $setting = $sett->setting;

            $this->addSql("INSERT IGNORE INTO setting (setting, value, type) VALUES ('$setting', null, '$type')
                            ON DUPLICATE KEY UPDATE type = '$type'");
        }
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs

    }
}
