45 lines
737 B
PHP
45 lines
737 B
PHP
|
<?php
|
||
|
|
||
|
namespace Nest\Database\Migrations\Model;
|
||
|
|
||
|
use Carbon\Carbon;
|
||
|
use Nest\Model\Entity;
|
||
|
use Nest\Model\EntityBlueprint;
|
||
|
use Nest\Types\Definitions\StringType;
|
||
|
|
||
|
/**
|
||
|
* Class of an executed migration.
|
||
|
*/
|
||
|
class Migration extends Entity
|
||
|
{
|
||
|
/**
|
||
|
* Migration version ID.
|
||
|
* @var string
|
||
|
*/
|
||
|
public string $id;
|
||
|
|
||
|
/**
|
||
|
* Migration name.
|
||
|
* @var string
|
||
|
*/
|
||
|
public string $name;
|
||
|
|
||
|
/**
|
||
|
* Migration execution date.
|
||
|
* @var Carbon
|
||
|
*/
|
||
|
public Carbon $created_at;
|
||
|
|
||
|
/**
|
||
|
* @inheritDoc
|
||
|
*/
|
||
|
public function definition(EntityBlueprint $blueprint): EntityBlueprint
|
||
|
{
|
||
|
$blueprint->field("id", StringType::class)->primary();
|
||
|
$blueprint->field("name", StringType::class)->index();
|
||
|
$blueprint->createdAt();
|
||
|
|
||
|
return $blueprint;
|
||
|
}
|
||
|
}
|