V
V
vetsinen2018-02-15 12:42:55
Yii
vetsinen, 2018-02-15 12:42:55

Is it worth doing several migrations for one task?

I'm doing a little yii problem that needs two tables to work. Should I create and delete each table in a separate migration or do everything necessary for this task in one migration?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Rogov, 2018-02-15
@RogovP

if they are related, then I think everything is needed in one migration,
I always do this - one task - one migration

D
Dmitry, 2018-02-15
@slo_nik

Good morning.
It's like looking.
You can do this and that.
I would do in two migrations. But again, you have to look.
Let's say you are making a module for selecting countries and cities. In this case, it would be appropriate to do everything in one migration. If you make "articles" and "comments" modules separately, then in this case it is better to do them in separate migration files.
If you make two migrations, you will not be able to remove the previous migration without affecting the last one.
That's just how migrations work.

P
Papa, 2018-02-15
Stifflera @PapaStifflera

Yes, it's worth it. Ideally: one object in the database - a separate migration.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question