<p>This is usually called a migration, try yii2, Laravel or doctrine</p>

<p>Mostly these frameworks will manage the schema in yml, XML or PHP and automatically calculate schema changes and apply them.</p>

<p>For data changes, you would package up a number of database queries or even program code into a migration, which usually has a forward/up step and a backward/down step.</p>

<p>Migration status is usually stored as a single value in a separate database table</p>

CC BY-SA 4.0
2018-12-14T17:42:41.460Z
Thank you, I did a quick search and I'm implementing Phinx (https://phinx.org/)
Michael Martone
CC BY-SA 4.0
2018-12-13T22:19:41.873Z
2018-12-13T22:19:41.873Z
jdog
<p>I have a PostgreSQL database that requires a server side script to be executed (client prefers php) to:</p>

<ul>
<li>Perform some intelligent data modifications to records that will be
identified  only during the update. </li>
<li>Update specific functions for a
dynamically identified list of schemas. </li>
<li>Generate a static rollback
script/data based upon what is being modified.</li>
</ul>

<p>I am hoping to integrate it with gitflow like process to allow for some control and visibility as in the past these types of changes were done manually.  I've been looking for something similar to libraries like phpunit to avoid reinventing.</p>

<p>Are there any scripting libraries or tools that can serve as a starting point. </p>

<continuous-integration><postgresql>
One time database update process as part of applying a patch
Michael Martone
# One time database update process as part of applying a patch

(Asked by: username_0 on 2018-12-13)

I have a PostgreSQL database that requires a server side script to be executed (client prefers php) to:

* Perform some intelligent data modifications to records that will be
  identified only during the update.
* Update specific functions for a
  dynamically identified list of schemas.
* Generate a static rollback
  script/data based upon what is being modified.

I am hoping to integrate it with gitflow like process to allow for some control and visibility as in the past these types of changes were done manually. I've been looking for something similar to libraries like phpunit to avoid reinventing.

Are there any scripting libraries or tools that can serve as a starting point.

**Tags:** continuous-integration, postgresql


---

## 1 answers

### Answer by username_1 on 2018-12-13. Score: 0 | Accepted answer

This is usually called a migration, try yii2, Laravel or doctrine

Mostly these frameworks will manage the schema in yml, XML or PHP and automatically calculate schema changes and apply them.

For data changes, you would package up a number of database queries or even program code into a migration, which usually has a forward/up step and a backward/down step.

Migration status is usually stored as a single value in a separate database table

> **Comments:**
> **username_0**: Thank you, I did a quick search and I'm implementing Phinx (https://phinx.org/)  

---

