C
C
Cyril2017-08-10 21:54:39
Yii
Cyril, 2017-08-10 21:54:39

How to make a migration to YII2 if I decide to add new fields to the table?

Let's say we have a Users model. How to build a SQL query (migration) using YII2 if I added several new fields to the Users model? It would be desirable to receive ready SQL after adding of any fields to model at once.
What steps need to be taken?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-08-11
@belyaevcyrill

1. Add fields to the model
2. Create a separate migration in which you write the logic for adding fields to the corresponding database tables using SQL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question