Files

32 lines
773 B
PHP
Raw Permalink Normal View History

<?php
/**
* SnapCAD veritabanı migrasyon betiği.
*
* Kullanım (proje kökünden):
* php database/migrate.php
*
* Bu betik yalnızca komut satırından çalışır. HTTP üzerinden erişilemez.
*/
declare(strict_types=1);
if (PHP_SAPI !== 'cli') {
http_response_code(404);
exit;
}
require_once dirname(__DIR__) . '/snap-config.php';
require_once __DIR__ . '/schema.php';
$pdo = snapcad_get_pdo();
if (!$pdo) {
fwrite(STDERR, "[migrate] Veritabanı bağlantısı kurulamadı. .env ayarlarını kontrol edin.\n");
exit(1);
}
try {
snapcad_apply_schema($pdo);
fwrite(STDOUT, "[migrate] SnapCAD şeması hazır.\n");
} catch (Throwable $e) {
fwrite(STDERR, '[migrate] Şema uygulanamadı: ' . $e->getMessage() . "\n");
exit(1);
}