42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Nest\Database\Migrations;
|
|
|
|
use Nest\Database\Migrations\Configuration\MigrationsConfiguration;
|
|
use Nest\Database\Exceptions\Query\MissingConditionValueException;
|
|
use Nest\Database\Exceptions\UnknownDatabaseException;
|
|
use Nest\Exceptions\Services\Configuration\UndefinedServiceConfigurationException;
|
|
use Nest\Types\Exceptions\IncompatibleTypeException;
|
|
|
|
/**
|
|
* Nest database migrations service.
|
|
*/
|
|
trait MigrationsService
|
|
{
|
|
/**
|
|
* The database migrations instance.
|
|
* @var Migrations
|
|
*/
|
|
private Migrations $migrations;
|
|
|
|
/**
|
|
* @throws UndefinedServiceConfigurationException
|
|
* @throws UnknownDatabaseException
|
|
* @throws MissingConditionValueException
|
|
* @throws IncompatibleTypeException
|
|
*/
|
|
protected function __nest__MigrationsService(): void
|
|
{
|
|
// Initialize database migrations instance.
|
|
$this->migrations = new Migrations($this, $this->getServiceConfiguration(MigrationsConfiguration::class));
|
|
}
|
|
|
|
/**
|
|
* Database migrations service.
|
|
* @return Migrations The database migrations manager.
|
|
*/
|
|
public function migrations(): Migrations
|
|
{
|
|
return $this->migrations;
|
|
}
|
|
}
|