Skip to content

Migrations/Schema sync workflow #257

Closed

Description

@icewind

Hi,
Could you please clarify for me the relation between schema:sync and migrations?

I expected migrations:create to diff my entities and write a revertible migrations file but it doesn't.
Schema:sync is not usable in web services since we can't allow uncontrolled db changes.

So my question is: Do I have to write RAW sql in migrations for CREATE TABLE ...? Can I refer to my Entity and build CREATE TABLE ... query from Entity metadata?
I mean, queryRunner can create a table using schema. How can I get that schema from my entity?

Thank you for such a good framework. I love it.
Thanks.

Activity

  1. pleerock commented on Feb 3, 2017

    @pleerock
    Member

    Hi,

    Do I have to write RAW sql in migrations for CREATE TABLE ...?

    yes, you do have

    Can I refer to my Entity and build CREATE TABLE ... query from Entity metadata?

    I have a plan to add facade interface to make it easily, but for now you have to handle it by yourself exploring internal api. Expect this improvement in the near future.

    migrations:create

    this command simply creates a file with migrations where you can write migration queries. I think in the future we will have ability to generate those migrations using cli.

  2. llwt commented on Mar 6, 2017

    @llwt

    Would love to see automatic generation of migrations. For the forward/up migration would it be as simple as pulling the logic form schema:sync into the file generation?

  3. pleerock commented on Mar 7, 2017

    @pleerock
    Member

    @llwt yes it should be something like that. I also would like to see automatic migration generation, thats a feature for the future.

  4. llwt commented on Jul 20, 2017

    @llwt

    @pleerock I noticed master has initial support for migration generation but the PostgresQueryRunner doesn't respect sqlMemoryMode yet. Would you be open to a PR that adds support (mimicking how it's implemented in the MysqlQueryRunner), or is there an issue with that pattern for Postgres?

    Also, super stoked to see this feature making it's way in!

  5. pleerock commented on Jul 21, 2017

    @pleerock
    Member

    yeah there is experimental support for mysql already, but not for other drivers yet. Would be great if community will help to implement it in other drivers as well

  6. pleerock commented on Jul 21, 2017

    @pleerock
    Member

    I'll close this issue in favour of #403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions