PHPackages                             crazedsanity/webdbupgrade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. crazedsanity/webdbupgrade

ActiveLibrary[Database &amp; ORM](/categories/database)

crazedsanity/webdbupgrade
=========================

Library for handling scripted upgrades to a web application

v0.1.0(9y ago)068MITPHPPHP &gt;=5.3.0

Since Nov 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crazedsanity/webdbupgrade)[ Packagist](https://packagist.org/packages/crazedsanity/webdbupgrade)[ Docs](https://github.com/crazedsanity/webdbupgrade)[ RSS](/packages/crazedsanity-webdbupgrade/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

CS Web DB Upgrade
=================

[](#cs-web-db-upgrade)

*NOTE:* this documentation is a work in progress, so take it as more guideline than rule. If you find something wrong with it, fix it and let me know through a pull request or however you'd like... or tell me about it. Or deal with it... whatever you prefer.

Preconceptions
--------------

[](#preconceptions)

CS Web DB Upgrade is built with a few preconceptions about your web application.

1. there is a concept of a "production" application
2. there is a test environment in which changes are tested
3. upgrades are scripted (schema, database values, filesystem things, etc)

The system can be configured to automatically upgrade every time a page is viewed, via a custom shell script, or... however you want. It's your application.

What It Does
------------

[](#what-it-does)

CS Web DB Upgrade is built to make upgrading a database-driven web application seamless. Instead of manually changing things in a certain sequence, automate that process by scripting it!

The Old Way:

1. Manually "mark" the site as being in maintenance (replacing the site with one that responds to all requests with "down for maintenance" or some such)
2. Manually update the code (overwrite it by extracting a zip, or using an SCM command--`svn update` or `git pull`)
3. Manually run schema changes
4. Manually update existing records
5. Manually fix existing configuration files
6. Manually fix existing misc files (eg. paths for images)
7. Hope things worked so far... if not, fix them, maybe do some praying and sweating
8. Manually "unmark" the site as beinig in maintenance mode (see #1)

Did you see a pattern?

Meet your savior! This system adds the ability to allow your system to upgrade itself. Whenever you increment the version in your VERSION file, it can run a custom script that will do everything you need AND keep others out until it is done. Once the system is updated, the next thing to touch the code containing the upgrade system will cause it to run.

The New Way:

1. Manually (or automatically) update application
2. Run the upgrade script (generally runs automatically when the application is used)

That's it! If the upgrade breaks for any reason, a special "lock file" will automatically put your application into "maintenance mode", preventing users from hitting the database. And this frees you from having to do anything special in order to turn on that "maintenance mode." Yay!

How to Work With CS Web DB Upgrade
----------------------------------

[](#how-to-work-with-cs-web-db-upgrade)

These steps help you get going with as little fuss as possible. Once you're familiar with the system, you'll be able to do just about anything you like.

Create a file, `upgrades/upgrade.ini`. The "main" section is the most important. Here's a sample:

```
[main]
initial_version=0.0.1

[v0.0.1]
target_version=0.0.2
script_name=upgradeTo0.0.2.php
class_name=upgrade_to_0_0_2
call_method=run_upgrade

[v0.0.2]
target_version=0.1.0
script_name=upgradeTo0.1.0.php
class_name=upgrade_to_0_1_0
call_method=run_upgrade

[v0.3.5-ALPHA1]
target_version=0.3.5-BETA2
script_name=upgradeTo0.3.5-BETA2.php
class_name=upgrade_to_0_3_5_BETA2
call_method=run_upgrade

[v0.3.6]
target_version=1.0.0
script_name=upgradeTo1.0.0.php
class_name=upgrade_to_1_0_0
call_method=run_upgrade

```

The flow should be somewhat obvious. Each index (excluding "main") is parsed as a version. So the upgrade path is:

0.0.1 -&gt; 0.0.2 -&gt; 0.0.2 -&gt; 0.1.0 -&gt; 0.3.5-ALPHA1 -&gt; 0.3.6 -&gt; 1.0.0

So, if there's an existing installation that has a version in the database of 0.2.0, all scripts from 0.3.5-ALPHA1 and beyond are run, to get it to the current version, which is probably at least 1.0.0 (though it could easily be 1.0.1 or higher; not all upgrades require scripted changes).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3520d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e5c258da2d3360da7bc80c01e0a97ff96a036cef58f8a5434daf469ad7cc186?d=identicon)[crazedsanity](/maintainers/crazedsanity)

---

Top Contributors

[![crazedsanity](https://avatars.githubusercontent.com/u/1490894?v=4)](https://github.com/crazedsanity "crazedsanity (5 commits)")

---

Tags

phpwebdatabaseupgrades

### Embed Badge

![Health badge](/badges/crazedsanity-webdbupgrade/health.svg)

```
[![Health](https://phpackages.com/badges/crazedsanity-webdbupgrade/health.svg)](https://phpackages.com/packages/crazedsanity-webdbupgrade)
```

###  Alternatives

[bvanhoekelen/performance

PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.

520824.8k5](/packages/bvanhoekelen-performance)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.7k](/packages/modul-is-orm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
