<?php
declare(strict_types=1);

return static function (PDO $pdo): void {
    if (!installHasTable($pdo, 'email_templates')) {
        throw new RuntimeException('Tabelle email_templates fehlt.');
    }

    if (!installHasColumn($pdo, 'email_templates', 'editor_mode')) {
        installRunSqlFile($pdo, installRootPath() . '/install/sql/add_email_template_editor_support.sql');
    }

    if (!installHasTable($pdo, 'settings')) {
        throw new RuntimeException('Tabelle settings fehlt.');
    }

    installRunSqlFile($pdo, installRootPath() . '/install/sql/seed_required_settings.sql');
};
