<p>You have options, but most people probably do the following...</p>

<ol>
<li>Apply the updates locally.</li>
<li>Push those changes to the server.</li>
<li>Have Craft run any necessary migrations.</li>
</ol>

<p>My deployment process ends with the following command being executed on the server:</p>

<pre><code>composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
</code></pre>

<p>And in my <code>composer.json</code> file, it runs this:</p>

<pre><code>  "scripts": {
    "post-install-cmd": [
      "./craft migrate/all"
    ],
    "post-update-cmd": [
      "./craft migrate/all"
    ]
  }
</code></pre>

<p>Between those two commands, it ensures that (A) all of the plugins and libraries specified in my composer file are identical on the production server, and (B) any necessary migrations are run after that.</p>

CC BY-SA 4.0
2019-06-13T20:49:06.210Z
Ah. Yea, good to hear that Craft has database migrations. Perhaps all serious systems have that nowadays. I am currently hosting the site on Hyperlane, and I am guessing they run similar command when composer runs. Just tested it and it worked fine ;-)
nitech
CC BY-SA 4.0
2019-06-13T19:39:58.257Z
2019-06-13T19:39:58.257Z
Lindsey D
<p>When developing a Craft 3 site on a multi-environment setup, where would I apply the Craft and Plugin updates? </p>

<p>Should I apply them locally and then commit and replace the database in the dev env, or in dev env and then pull down the database? </p>

<p>Or does Craft have some versioning of the database through db migrations that will help this issue? (Is this where <code>project.yaml</code> comes into play?)</p>

<database><migration><updates><project.yaml>
Database migrations on environments - in which env do I apply updates to Craft and Plugins?
# Database migrations on environments - in which env do I apply updates to Craft and Plugins?

(Asked by: username_0 on 2019-06-13)

When developing a Craft 3 site on a multi-environment setup, where would I apply the Craft and Plugin updates?

Should I apply them locally and then commit and replace the database in the dev env, or in dev env and then pull down the database?

Or does Craft have some versioning of the database through db migrations that will help this issue? (Is this where `project.yaml` comes into play?)

**Tags:** database, migration, updates, project.yaml

---

## 1 answers

### Answer by username_1 on 2019-06-13. Score: 2 | Accepted answer

You have options, but most people probably do the following...

Apply the updates locally.
Push those changes to the server.
Have Craft run any necessary migrations.

My deployment process ends with the following command being executed on the server:
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev

And in my composer.json file, it runs this:
  "scripts": {
    "post-install-cmd": [
      "./craft migrate/all"
    ],
    "post-update-cmd": [
      "./craft migrate/all"
    ]
  }

Between those two commands, it ensures that (A) all of the plugins and libraries specified in my composer file are identical on the production server, and (B) any necessary migrations are run after that.

> **Comments:**
> **username_0**: Ah. Yea, good to hear that Craft has database migrations. Perhaps all serious systems have that nowadays. I am currently hosting the site on Hyperlane, and I am guessing they run similar command when composer runs. Just tested it and it worked fine ;-)  

---

