Deploy from Lumerel

This commit is contained in:
Lumerel Deploy
2026-02-16 23:40:03 +00:00
commit b6634ff1cb
20 changed files with 1156 additions and 0 deletions

View File

@@ -0,0 +1,185 @@
<?php
require_once __DIR__ . '/../db.php';
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Migration Status - TaskIt!</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
max-width: 1000px;
margin: 40px auto;
padding: 20px;
background: #f5f5f5;
}
h1 {
color: #333;
border-bottom: 3px solid #4CAF50;
padding-bottom: 10px;
}
.status {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.success { color: #4CAF50; font-weight: bold; }
.error { color: #f44336; font-weight: bold; }
table {
width: 100%;
border-collapse: collapse;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background: #4CAF50;
color: white;
font-weight: 600;
}
tr:hover {
background: #f5f5f5;
}
.available {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
margin-top: 20px;
}
.available h2 {
color: #333;
margin-top: 0;
}
.available ul {
list-style: none;
padding: 0;
}
.available li {
padding: 8px;
margin: 4px 0;
background: #f9f9f9;
border-left: 3px solid #2196F3;
padding-left: 12px;
}
.available li.ran {
border-left-color: #4CAF50;
opacity: 0.6;
}
.available li.pending {
border-left-color: #ff9800;
font-weight: bold;
}
code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
}
</style>
</head>
<body>
<h1>🔍 Migration Status</h1>
<div class="status">
<?php
try {
// Check if migrations table exists
$tables = $pdo->query("SHOW TABLES LIKE 'migrations'")->fetchAll();
if (empty($tables)) {
echo '<p class="error">❌ Migrations table does not exist yet!</p>';
echo '<p>This means <code>migrate.php</code> has not run successfully.</p>';
} else {
echo '<p class="success">✅ Migrations table exists</p>';
// Get all ran migrations
$ranMigrations = $pdo->query("SELECT * FROM migrations ORDER BY ran_at DESC")->fetchAll();
if (empty($ranMigrations)) {
echo '<p class="error">⚠️ No migrations have been run yet!</p>';
} else {
echo '<p class="success">✅ ' . count($ranMigrations) . ' migration(s) have been run</p>';
}
}
} catch (PDOException $e) {
echo '<p class="error">❌ Database Error: ' . htmlspecialchars($e->getMessage()) . '</p>';
}
?>
</div>
<?php if (!empty($ranMigrations)): ?>
<h2>Migrations Run</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Migration</th>
<th>Run At</th>
</tr>
</thead>
<tbody>
<?php foreach ($ranMigrations as $migration): ?>
<tr>
<td><?= htmlspecialchars($migration['id']) ?></td>
<td><code><?= htmlspecialchars($migration['migration']) ?></code></td>
<td><?= htmlspecialchars($migration['ran_at']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="available">
<h2>Available Migration Files</h2>
<?php
$migrationsDir = __DIR__ . '/../migrations';
if (is_dir($migrationsDir)) {
$files = scandir($migrationsDir);
$migrationFiles = array_filter($files, function($file) {
return pathinfo($file, PATHINFO_EXTENSION) === 'php';
});
sort($migrationFiles);
$ranNames = !empty($ranMigrations) ? array_column($ranMigrations, 'migration') : [];
if (empty($migrationFiles)) {
echo '<p class="error">No migration files found in /migrations directory</p>';
} else {
echo '<ul>';
foreach ($migrationFiles as $file) {
$isRan = in_array($file, $ranNames);
$class = $isRan ? 'ran' : 'pending';
$status = $isRan ? '✅' : '⏳';
echo '<li class="' . $class . '">' . $status . ' <code>' . htmlspecialchars($file) . '</code></li>';
}
echo '</ul>';
}
} else {
echo '<p class="error">Migrations directory not found</p>';
}
?>
</div>
<div class="status" style="margin-top: 20px;">
<h3>Database Connection Info</h3>
<p><strong>Host:</strong> <?= htmlspecialchars(getenv('DB_HOST') ?: 'Not set') ?></p>
<p><strong>Port:</strong> <?= htmlspecialchars(getenv('DB_PORT') ?: 'Not set') ?></p>
<p><strong>Database:</strong> <?= htmlspecialchars(getenv('DB_DATABASE') ?: 'Not set') ?></p>
<p><strong>Username:</strong> <?= htmlspecialchars(getenv('DB_USERNAME') ?: 'Not set') ?></p>
<p><strong>Password:</strong> <?= getenv('DB_PASSWORD') ? '✅ Set' : '❌ Not set' ?></p>
</div>
</body>
</html>