2018-12-16 14:08:03 +03:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Shlinkio\Shlink\Rest;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Types\Type;
|
|
|
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
2019-08-11 14:44:42 +03:00
|
|
|
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
|
2018-12-16 14:08:03 +03:00
|
|
|
|
|
|
|
/** @var $metadata ClassMetadata */
|
|
|
|
$builder = new ClassMetadataBuilder($metadata);
|
|
|
|
|
|
|
|
$builder->setTable('api_keys');
|
|
|
|
|
|
|
|
$builder->createField('id', Type::BIGINT)
|
|
|
|
->makePrimaryKey()
|
|
|
|
->generatedValue('IDENTITY')
|
|
|
|
->option('unsigned', true)
|
|
|
|
->build();
|
|
|
|
|
|
|
|
$builder->createField('key', Type::STRING)
|
|
|
|
->columnName('`key`')
|
|
|
|
->unique()
|
|
|
|
->build();
|
|
|
|
|
|
|
|
$builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME)
|
|
|
|
->columnName('expiration_date')
|
|
|
|
->nullable()
|
|
|
|
->build();
|
|
|
|
|
|
|
|
$builder->createField('enabled', Type::BOOLEAN)
|
|
|
|
->build();
|