Files
dockerfluxodecaixapro/bin/install_eventsguide.php
T
2026-09-01 10:46:29 -03:00

40 lines
1.3 KiB
PHP
Executable File

<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Kernel\Application;
$app = new Application();
// Run Migrations
$migrations = [
__DIR__ . '/../modules/eventsguide/database/migrations/001_create_events_table.php',
__DIR__ . '/../modules/eventsguide/database/migrations/002_create_event_gallery_table.php',
__DIR__ . '/../modules/eventsguide/database/migrations/003_create_event_reports_table.php',
__DIR__ . '/../modules/eventsguide/database/migrations/004_create_event_ads_table.php',
__DIR__ . '/../modules/eventsguide/database/migrations/005_insert_module_record.php',
];
foreach ($migrations as $file) {
if (file_exists($file)) {
require_once $file;
// Extract class name from file content
$content = file_get_contents($file);
if (preg_match('/class\s+(\w+)/', $content, $matches)) {
$className = $matches[1];
if (class_exists($className)) {
echo "Running $className...\n";
$migration = new $className();
$migration->up();
echo "$className done.\n";
} else {
echo "Class $className not found in $file\n";
}
}
} else {
echo "File not found: $file\n";
}
}
echo "Installation complete.\n";