This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Description Primary key does not always come first in generated migrations:
<?php
declare (strict_types=1 );
namespace App ;
use Cycle \Annotated \Annotation as Cycle ;
trait UuidTrait
{
/**
* @Cycle\Column(type="uuid", primary=true)
*/
public string $ id ;
}
trait CreationTimeTrait
{
/**
* @Cycle\Column(type="datetime", nullable=true)
*/
public \DateTimeImmutable $ creationTime ;
}
/**
* @Cycle\Entity()
*/
class Export
{
use CreationTimeTrait;
use UuidTrait;
#[Cycle \Column(type: 'text ' )]
public string $ title ;
#[Cycle \Column(type: 'text ' , nullable: true )]
public ?string $ filePath = null ;
#[Cycle \Column(type: 'string ' )]
public string $ state ;
}
Code above results in this migration:
$ this ->table ('exports ' )
->addColumn ('title ' , 'text ' , [
'nullable ' => false ,
'default ' => null
])
->addColumn ('file_path ' , 'text ' , [
'nullable ' => true ,
'default ' => null
])
->addColumn ('state ' , 'string ' , [
'nullable ' => false ,
'default ' => null ,
'size ' => 255
])
->addColumn ('creation_time ' , 'datetime ' , [
'nullable ' => true ,
'default ' => null
])
->addColumn ('id ' , 'uuid ' , [
'nullable ' => false ,
'default ' => null
])
->setPrimaryKeys (["id " ])
->create ();
Id is the last column of the table so it's not very convenient to browse this table in DB client
Reactions are currently unavailable
Primary key does not always come first in generated migrations:
Code above results in this migration:
Id is the last column of the table so it's not very convenient to browse this table in DB client