castopod/modules/Install/Commands/InitDatabase.php
Yassine Doghri f295e9aa4c chore: update CodeIgniter to v4.5.6
+ update php dependencies to latest
2024-12-29 16:02:08 +00:00

41 lines
752 B
PHP

<?php
declare(strict_types=1);
namespace Modules\Install\Commands;
use CodeIgniter\CLI\BaseCommand;
use Config\Database;
use Override;
class InitDatabase extends BaseCommand
{
/**
* @var string
*/
protected $group = 'Install';
/**
* @var string
*/
protected $name = 'install:init-database';
/**
* @var string
*/
protected $description = 'Runs all database migrations for Castopod.';
#[Override]
public function run(array $params): void
{
// Run all migrations
$migrate = service('migrations');
$migrate->setNamespace(null)
->latest();
// Seed database
$seeder = Database::seeder();
$seeder->call('AppSeeder');
}
}