<?php

declare(strict_types=1);

// SPDX-FileCopyrightText: Chen Asraf <contact@casraf.dev>
// SPDX-License-Identifier: AGPL-3.0-or-later

namespace OCA\Forum\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
 * Version 13 Migration:
 * - Ensure forum_users table exists (fixes fresh installs where table was missing)
 *
 * Note: The seedAll() call was moved to Version14 migration to fix an issue where
 * the seeding used hardcoded role IDs that may not exist during upgrades.
 */
class Version13Date20251231000000 extends SimpleMigrationStep {
	/**
	 * @param IOutput $output
	 * @param Closure(): ISchemaWrapper $schemaClosure
	 * @param array $options
	 */
	public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
		// SeedHelper ensures forum_users table exists (table creation only, seeding moved to Version14)
		SeedHelper::ensureForumUsersTablePublic($output);
	}
}
