ensureFrameworkTablesExist static method

Future<void> ensureFrameworkTablesExist()

Implementation

static Future<void> ensureFrameworkTablesExist() async {
  if (_frameworkTablesEnsured) return;

  try {
    // Only check/create the framework-specific tables
    final passwordResetExists = await _tableExists('password_reset_tokens');
    final emailVerifyExists = await _tableExists('email_verification_tokens');

    if (!passwordResetExists || !emailVerifyExists) {
      print('🔄 Creating framework auth tables...');
      await _createFrameworkTables();
    }

    _frameworkTablesEnsured = true;
  } catch (e) {
    throw AuthException('Framework table setup failed: $e');
  }
}