We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon migration and Teamwork

Hi, I got the issue with migration and teamwork.

There are two developer ( dev1 and dev2) :

Dev1 create 2 table (posts, categories) and push to git. ( migration : 1.0.0)

Dev2 pull and run migration. ( 1.0.0)

Dev1 create table users and generate migration ( 1.0.1) and push

Dev2 create table products and generate 1.0.1

Dev2 create table countries and generate ( 1.0.2)

Dev2 pull and push

Now both Dev1 and Dev2 run migration, but Dev2 never has users table, because it is at v1.0.1.

I tried but it didnt work. What should I do or phalcon is not for teamwork like this case ?

I got a solution, I change file : app/.phalcon/migration-verion from 1.x.x to 1.0.0 and it works. Is it best solution ?

Hello,

What you did is the right way. In the first place "migration-version" file shouldn't be pushed to git; it should be keeped locally so each developer can run only the migrations that aren't run yet.

When you run migrations, phalcon dev tools are running all migrations higher than the version from the "migration-version" file.

In this case if 2 developers create migration 1.0.1 and commit, then they'll have to change the version in file to 1.0.0 to run 1.0.1. Indeed is not the best stragery for teamwork :)