2018-12-16 05:08:03 -06:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2018-12-16 05:08:03 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Shlinkio\Shlink\Core;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Types\Type;
|
|
|
|
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
2019-08-24 03:25:43 -05:00
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
|
2018-12-16 05:08:03 -06:00
|
|
|
|
2019-10-05 10:26:10 -05:00
|
|
|
/** @var $metadata ClassMetadata */ // @codingStandardsIgnoreLine
|
2018-12-16 05:08:03 -06:00
|
|
|
$builder = new ClassMetadataBuilder($metadata);
|
|
|
|
|
|
|
|
$builder->setTable('visit_locations');
|
|
|
|
|
|
|
|
$builder->createField('id', Type::BIGINT)
|
|
|
|
->columnName('id')
|
|
|
|
->makePrimaryKey()
|
|
|
|
->generatedValue('IDENTITY')
|
|
|
|
->option('unsigned', true)
|
|
|
|
->build();
|
|
|
|
|
|
|
|
$columns = [
|
|
|
|
'country_code' => 'countryCode',
|
|
|
|
'country_name' => 'countryName',
|
|
|
|
'region_name' => 'regionName',
|
|
|
|
'city_name' => 'cityName',
|
|
|
|
'latitude' => 'latitude',
|
|
|
|
'longitude' => 'longitude',
|
|
|
|
'timezone' => 'timezone',
|
|
|
|
];
|
|
|
|
|
|
|
|
foreach ($columns as $columnName => $fieldName) {
|
|
|
|
$builder->createField($fieldName, Type::STRING)
|
|
|
|
->columnName($columnName)
|
|
|
|
->nullable()
|
|
|
|
->build();
|
|
|
|
}
|