Skip to main content
deleted 5 characters in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

First of all, very good question.
But...I don't agree with this:

The problem is when someone install the project he doesn't have this file but he already have the database so he can't run bin/magento setup:install ...

I would say that when you install the project, if you already have the database, you should take the config.php file also from the same place you got the database.
This way you don't have to run setup:install and you have everything as it should be.

I would not recommend versioning this file because of the following scenario.

  • You add a new module on the dev env.
  • You run setup:upgrade so the module appears not in config.php
  • You commit your code and deploy it on an other env.
  • Your other env instance thinks your new module is already installed and you get an error.

So I guess the best solution (IMO) would be to just not version it and do this depending on your case:

  • You clone the project with and the database somewhere else, you should clone the config.php file also (along with others like pub/media) so you won't have outdated data.
  • You clone only the files in the repo and start on a clean slate, don't copy config.php, just run the installer that will create that for you.

First of all, very good question.
But...I don't agree with this:

The problem is when someone install the project he doesn't have this file but he already have the database so he can't run bin/magento setup:install ...

I would say that when you install the project, if you already have the database, you should take the config.php file also from the same place you got the database.
This way you don't have to run setup:install and you have everything as it should be.

I would not recommend versioning this file because of the following scenario.

  • You add a new module on the dev env.
  • You run setup:upgrade so the module appears not in config.php
  • You commit your code and deploy it on an other env.
  • Your other env instance thinks your new module is already installed and you get an error.

So I guess the best solution (IMO) would be to just not version it and do this depending on your case:

  • You clone the project with and the database somewhere else, you should clone the config.php file also (along with others like pub/media) so you won't have outdated data.
  • You clone only the files in the repo and start on a clean slate, don't copy config.php, just run the installer that will create that for you.

First of all, very good question.
But...I don't agree with this:

The problem is when someone install the project he doesn't have this file but he already have the database so he can't run bin/magento setup:install ...

I would say that when you install the project, if you already have the database, you should take the config.php file also from the same place you got the database.
This way you don't have to run setup:install and you have everything as it should be.

I would not recommend versioning this file because of the following scenario.

  • You add a new module on the dev env.
  • You run setup:upgrade so the module appears not in config.php
  • You commit your code and deploy it on an other env.
  • Your other env instance thinks your new module is already installed and you get an error.

So I guess the best solution (IMO) would be to just not version it and do this depending on your case:

  • You clone the project and the database somewhere else, you should clone the config.php file also (along with others like pub/media) so you won't have outdated data.
  • You clone only the files in the repo and start on a clean slate, don't copy config.php, just run the installer that will create that for you.
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

First of all, very good question.
But...I don't agree with this:

The problem is when someone install the project he doesn't have this file but he already have the database so he can't run bin/magento setup:install ...

I would say that when you install the project, if you already have the database, you should take the config.php file also from the same place you got the database.
This way you don't have to run setup:install and you have everything as it should be.

I would not recommend versioning this file because of the following scenario.

  • You add a new module on the dev env.
  • You run setup:upgrade so the module appears not in config.php
  • You commit your code and deploy it on an other env.
  • Your other env instance thinks your new module is already installed and you get an error.

So I guess the best solution (IMO) would be to just not version it and do this depending on your case:

  • You clone the project with and the database somewhere else, you should clone the config.php file also (along with others like pub/media) so you won't have outdated data.
  • You clone only the files in the repo and start on a clean slate, don't copy config.php, just run the installer that will create that for you.