Access Denied

You must be logged in as an administrator to access this page.

Go to Admin Panel '); } // Check if API module is active if (!$CI->app_modules->is_active('api')) { die('

API Module Not Active

The API module must be activated before running migrations.

Go to Setup → Modules and activate the API module.

Go to Modules
'); } $message = ''; $action = isset($_POST['action']) ? $_POST['action'] : ''; $target_version = isset($_POST['target_version']) ? (int)$_POST['target_version'] : null; // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { require_once 'migration_runner.php'; $runner = new APIMigrationRunner(); switch ($action) { case 'upgrade': $success = $runner->run($target_version, false); $message = $success ? '
✅ All migrations completed successfully!
' : '
❌ Some migrations failed. Check the output above.
'; break; case 'rollback': $success = $runner->run($target_version, true); $message = $success ? '
✅ Rollback completed successfully!
' : '
❌ Rollback failed. Check the output above.
'; break; case 'check_status': // Just show current status break; } } catch (Exception $e) { $message = '
❌ Error: ' . htmlspecialchars($e->getMessage()) . '
'; } } // Get current status $current_version = 0; $migration_table = db_prefix() . 'migrations'; if ($CI->db->table_exists('migrations')) { $result = $CI->db->select('version')->from('migrations')->where('module', 'api')->get(); if ($result->num_rows() > 0) { $current_version = $result->row()->version; } } // Get available migrations $migrations = []; $files = glob('migrations/*_version_*.php'); foreach ($files as $file) { if (preg_match('/(\d+)_version_(\d+)\.php$/', basename($file), $matches)) { $version = (int) $matches[1]; $migrations[$version] = 'Version_' . $matches[1]; } } ksort($migrations); $pending_migrations = array_filter($migrations, function($version) use ($current_version) { return $version > $current_version; }, ARRAY_FILTER_USE_KEY); ?> API Module Database Migrations

🚀 API Module Database Migrations

📊 Current Status

Current Migration Version:

API Module Status: ✅ Active

Database Connection: ✅ Connected

Pending Migrations:

📋 Available Migrations

No migrations found.

$name): ?>
Version : ✅ Applied ⏳ Pending

🔧 Migration Actions

Specify a version number to migrate to that specific version

📄 Migration Output

run($target_version, ($action === 'rollback')); $output = ob_get_clean(); echo htmlspecialchars($output); ?>

📖 Instructions

← Back to Modules