How to use ./flow core:migrate

Hello,

in flow docs it says that ./flow core:migrate command will apply pending code migrations.
But I don’t understand:

  1. what a migration is,
  2. who/how is it created,
  3. in which cases this command should be used.

I will be grateful for any resources or knowledge shared on this matter.

Thank you

Hi,
basically, - you have 2 different types of ‘migration’ as cli-commands …

  • ./flow core:migrate (your question)
  • ./flow doctrine: migrate
    ===== ===== ===== =====

First one concerns ‘consolidated changes’ (version) of the framework-code that may be related in third (your own) packages.

With this command, this packages are parsed to find and replace the ‘terms’ concerned in the respective ‘core-migration’.
Doing this, simultaneously there will be created a ‘Git-commit’ with these code changes of that migration.
You will find this commits in your ‘Git-environnement’ and you will check those ! (revert if necessary)

Each of these committed ‘code-migrations’ are mentioned now in the composer file of your respective package as a ‘History’ of accomplished ‘code migrations’ …
===== ===== ===== =====

Second one (doctrine:migrate) would migrate code changes relevant to the model and therefore concerning the persistence layer, - which is normally the MySQL-database …
a) you would do the CORE-migration (s)
b) if model/dB concerned, you would do a … ‘doctrine :migrationgenerate’ to generate the DOCTRINE-migration(s) for your package …
c) finally you would migrate the dB with these DOCTRINE-migrations
===== ===== ===== =====

  1. Does this answers your first questions ?
  2. You have to apply these CORE-migrations normally when you upgrade your own packages to the next major version of the framework …

I hope that these explanations are more or less correct ?
(if somebody could confirm …)

1 Like

Hi Christoph,
thank you for the thorough response.

I knew about doctrine migrations.
So, to conclude, core migrations are created by the core team to facilitate your packages upgrade when you decide to upgrade your project to the next framework major release?

Exactly, - that’s what I wanted to say actually … :grinning: