mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-08-29 23:17:19 +02:00
40 lines
744 B
PHP
40 lines
744 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace Modules\Install\Commands;
|
||
|
|
||
|
use CodeIgniter\CLI\BaseCommand;
|
||
|
use Config\Database;
|
||
|
use Config\Services;
|
||
|
|
||
|
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.';
|
||
|
|
||
|
public function run(array $params): void
|
||
|
{
|
||
|
// Run all migrations
|
||
|
$migrate = Services::migrations();
|
||
|
$migrate->setNamespace(null)
|
||
|
->latest();
|
||
|
|
||
|
// Seed database
|
||
|
$seeder = Database::seeder();
|
||
|
$seeder->call('AppSeeder');
|
||
|
}
|
||
|
}
|