2019-09-30 12:42:27 -05:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2019-09-30 12:42:27 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Shlinkio\Shlink\Core;
|
|
|
|
|
2020-01-06 16:08:14 -06:00
|
|
|
use Doctrine\DBAL\Types\Types;
|
2019-09-30 12:42:27 -05:00
|
|
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
2020-01-29 03:06:42 -06:00
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
2019-09-30 12:42:27 -05:00
|
|
|
|
2020-01-29 03:53:06 -06:00
|
|
|
return static function (ClassMetadata $metadata, array $emConfig): void {
|
2020-01-29 03:06:42 -06:00
|
|
|
$builder = new ClassMetadataBuilder($metadata);
|
2019-09-30 12:42:27 -05:00
|
|
|
|
2020-01-29 03:53:06 -06:00
|
|
|
$builder->setTable(determineTableName('domains', $emConfig));
|
2019-09-30 12:42:27 -05:00
|
|
|
|
2020-01-29 03:06:42 -06:00
|
|
|
$builder->createField('id', Types::BIGINT)
|
|
|
|
->columnName('id')
|
|
|
|
->makePrimaryKey()
|
|
|
|
->generatedValue('IDENTITY')
|
|
|
|
->option('unsigned', true)
|
|
|
|
->build();
|
2019-09-30 12:42:27 -05:00
|
|
|
|
2020-01-29 03:06:42 -06:00
|
|
|
$builder->createField('authority', Types::STRING)
|
|
|
|
->unique()
|
|
|
|
->build();
|
|
|
|
};
|