M
M
Messi2018-05-29 15:52:29
Yii
Messi, 2018-05-29 15:52:29

How to make a conditional migration?

Hello! Can you please tell me how to make a conditional migration?
For example, there are two different environments of the same project, and once in one of the environments a field was added to the database "on the fly" in one of the tables (let's say price ). Now this field needs to be added to the migration, but how to make it so that it does not "fall" on another environment, such as adding a check to the migration, if the field is already in the specified table, then simply write down the migration that passed, and if not, then add the field to table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2018-05-29
@FitTech

Write a complete migration, and mark it as applied. This way you synchronize the state between environments, and there will be no problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question