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