$result) { if (!empty($result['ok'])) { $ok++; } else { $failed = $name . ': ' . ($result['message'] ?? 'failed'); break; } } if ($failed !== '') { acp_flash_error(h($failed)); } else { acp_log('system.migrations', '', ['applied' => array_keys($results)]); acp_flash_success('Applied ' . $ok . ' migration' . ($ok === 1 ? '' : 's') . '.'); } } acp_redirect('migrations'); } if ($action === 'run_one') { $name = basename((string)($_POST['migration'] ?? '')); $result = znote_migration_run($name); if (!empty($result['ok'])) { acp_log('system.migration', $name, ['statements' => $result['statements'] ?? 0]); acp_flash_success(h($name) . ': ' . h((string)$result['message'])); } else { acp_flash_error(h($name) . ': ' . h((string)$result['message'])); } acp_redirect('migrations'); } acp_redirect('migrations'); } $status = znote_migrations_status(); $pending = array_filter($status, static fn(array $row): bool => $row['state'] === 'pending'); $applied = array_filter($status, static fn(array $row): bool => $row['state'] === 'applied'); $warnings = array_filter($status, static fn(array $row): bool => in_array($row['state'], array('changed', 'missing'), true)); ?>
Runs SQL files from SQL/migrations and records successful executions in znote_migrations.
| Migration | Status | Checksum | Executed | Time | Action |
|---|---|---|---|---|---|
|
= h($row['name']) ?>
= h(number_format((int)$row['size'])) ?> bytes |
= h(acp_migration_state_label($state)) ?> | = h(substr((string)$row['checksum'], 0, 12)) ?> |
= h(date('Y-m-d H:i:s', (int)$appliedRow['executed_at'])) ?> Never | = h((string)(int)$appliedRow['execution_time_ms']) ?> ms - | File changed Missing Done |