Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect @Embedded property order when you generate migration's columns #17

Open
anlamas opened this issue Feb 22, 2021 · 0 comments
Open
Labels
type:enhancement Enhancement.

Comments

@anlamas
Copy link

anlamas commented Feb 22, 2021

Entities

/**
 * @Cycle\Entity()
 */
class Post
{
    /**
     * @Cycle\Column(type="primary")
     */
    public int $id;

    /**
     * @Cycle\Relation\Embedded(target="Seo")
     */
    public Seo $seo;

    /**
     * @Cycle\Column(type="primary")
     */
    public DateTimeImmutable $createdAt;
}
/**
 * @Embeddable(columnPrefix="seo_")
 */
class Seo
{
    /**
     * @Cycle\Column(type="string", name="title", nullable=true)
     */
    public ?string $title;

    /**
     * @Cycle\Column(type="string", name="description", nullable=true)
     */
    public ?string $description;

    /**
     * @Cycle\Column(type="string", name="keywords", nullable=true)
     */
    public ?string $keywords;
}

Generated migration

$this->table('posts')
    ->addColumn('id', 'primary', [
        'nullable' => false,
        'default'  => null
    ])
    ->addColumn('created_at', 'primary', [
        'nullable' => false,
        'default'  => null
    ])
    ->addColumn('seo_title', 'string', [
        'nullable' => true,
        'default'  => null,
        'size'     => 255
    ])
    ->addColumn('seo_description', 'string', [
        'nullable' => true,
        'default'  => null,
        'size'     => 255
    ])
    ->addColumn('seo_keywords', 'string', [
        'nullable' => true,
        'default'  => null,
        'size'     => 255
    ])
    ->setPrimaryKeys(["id", "created_at"])
    ->create();

What i want is that created_at should be generated after Seo columns, i.e. in this case after seo_keywords

@roxblnfk roxblnfk added the type:enhancement Enhancement. label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement.
Projects
Status: Backlog
Development

No branches or pull requests

2 participants