OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform Exists 'dropManyToOneRelation' in migrations?

This topic contains 8 replies, has 3 voices, and was last updated by  spyout98 6 years ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #37111

    spyout98
    Participant

    There is a method ‘addManyToOneRelation’ for migrations. Exists ‘dropManyToOneRelation’ in migrations?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #37112

    spyout98
    Participant

    If no, how do I remove a ManyToOneRelation in OroCRM or OroPlatform?

    That is my migration code:

    I want to destroy this relationship in another migration.

    #37113

    spyout98
    Participant

    ?

    #37114

    Michael
    Keymaster

    Same question on GitHub

    #37115

    spyout98
    Participant

    I’ve created there too. Because I don’t know exactly where is the best place for this kind of question.

    #37116

    Michael
    Keymaster

    Either one is good place. Linking them for the conveninence of others looking for the same answer later.

    #37117

    spyout98
    Participant

    Anyway, how do I do this? To remove completely the relation in orocrm_contact table and others possible auxiliar tables and records in another tables that Oro may created?

    #37118

    Alexander
    Moderator

    Hi @spyout98

    The custom relation config can be removed with ‘RemoveOneToManyRelationQuery’, so the relation will not be available in UI
    For example, the migration I’ve been using with ‘User’ entity to check:

    But in general ‘RemoveOneToManyRelationQuery’, ‘RemoveManyToManyRelationQuery’, ‘RemoveManyToOneRelationQuery’ removes ONLY configuration of an extend relation, so the data fields are still remains in database.

    You can execute the command app/console doctrine:schema:update --dump-sql and the result will be something like

    so, the removal of indices, foreign keys and columns is still the developers responsibility and you will need to add such drops into migration as well, e.g.

    #37119

    spyout98
    Participant

    Thank you so much, @Alexander!

Viewing 8 replies - 1 through 8 (of 8 total)

The forum ‘OroPlatform’ is closed to new topics and replies.

Back to top