PHPackages                             com.jukusoft/php-database-table-upgrader - 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. com.jukusoft/php-database-table-upgrader

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

com.jukusoft/php-database-table-upgrader
========================================

php-database-table-upgrader, An database upgrader for upgrade mysql table structures automatically. You dont have to write CREATE TABLE, ALTER TABLE querys and so on anymore, just configure your table structure in PHP and the classes will upgrade your table structures automatically.

0.0.1(9y ago)022LGPL 3.0PHPPHP &gt;=7.0.8

Since Aug 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/JuKu/php-database-table-upgrader)[ Packagist](https://packagist.org/packages/com.jukusoft/php-database-table-upgrader)[ Docs](https://github.com/JuKu/php-database-table-upgrader)[ RSS](/packages/comjukusoft-php-database-table-upgrader/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

php-database-table-upgrader
===========================

[](#php-database-table-upgrader)

An database upgrader for upgrade mysql table structures automatically

Version: 0.0.1 alpha License: LGPL 3.0

Currently upgrade isnt fully integrated, but table creation should be work. Work in Progress!

Requirements
------------

[](#requirements)

- PHP 7.0.8+
- MySQL 5.7+

Configuration
-------------

[](#configuration)

If you want to use the build-in MySQLDriver, you have to copy config/mysql.examplecfg.php to mysql.cfg.php and change values.

Supported Data Types
--------------------

[](#supported-data-types)

- INT
- VARCHAR
- TEXT
- CHAR
- TINYTEXT
- MEDIUMTEXT
- LONGTEXT (4294967295 characters)
- BIT
- BINARY
- TINYINT
- SMALLINT
- MEDIUMINT
- BIGINT
- DECIMAL
- NUMERIC
- DOUBLE
- FLOAT
- REAL
- BLOB
- TINYBLOB
- MEDIUMBLOB
- LONGBLOB
- ENUM
- SET
- DATE
- TIME
- YEAR
- TIMESTAMP
- DATETIME
- JSON

Supported Keys and Indexes
--------------------------

[](#supported-keys-and-indexes)

- PRIMARY KEY
- INDEX
- UNIQUE
- SPATIAL
- FULLTEXT
- FOREIGN KEY
- more are Work in Progress

Example
-------

[](#example)

Generate CREATE TABLE query:

```
//create or upgrade test table
$table = new DBTable("test", $dbDriver);
$table->setEngine("InnoDB");
$table->setCharset("utf8");

//add int coloum
$table->addInt("id");

//add int coloum with length 10, NOT NULL and AUTO_INCREMENT
$table->addInt("testint", 10, true, true);

//add varchar column
$table->addVarchar("test_text", 255, true, "default value");

//add text column
$table->addText("text");

//print CREATE statement for debugging
echo $table->generateCreateQuery();
```

prints following query:

```
CREATE TABLE `{DBPRAEFIX}test` IF NOT EXISTS (
`id` INT,
`testint` INT(10) NOT NULL AUTO_INCREMENT,
`test_text` VARCHAR(255) NOT NULL DEFAULT 'default value',
`text` TEXT
) TYPE=InnoDB DEFAULT CHARSET=utf8;
```

### How to add an PRIMARY KEY

[](#how-to-add-an-primary-key)

PRIMARY with only 1 column:

```
//add primary key
$table->addPrimaryKey("column_name");
```

PRIMARY KEY with more than 1 column:

```
//add primary key
$table->addPrimaryKey(array("id", "testint"));
```

Because PRIMARY KEYS are limited to specific length, you can also specifiy length of columns used in PRIMARY KEY:

```
//add primary key
$table->addPrimaryKey(array("id", "testint", array('column' => "test_text", 'length' => 50)));
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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

3608d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1138046?v=4)[JuKu](/maintainers/JuKu)[@JuKu](https://github.com/JuKu)

---

Top Contributors

[![JuKu](https://avatars.githubusercontent.com/u/1138046?v=4)](https://github.com/JuKu "JuKu (116 commits)")

---

Tags

phpdatabasemysqlPHP7upgraderMySQL5database upgraderauto upgradeautomatically database upgrader

### Embed Badge

![Health badge](/badges/comjukusoft-php-database-table-upgrader/health.svg)

```
[![Health](https://phpackages.com/badges/comjukusoft-php-database-table-upgrader/health.svg)](https://phpackages.com/packages/comjukusoft-php-database-table-upgrader)
```

###  Alternatives

[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k6.0M76](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.1k](/packages/clouddueling-mysqldump-php)[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11712.4k](/packages/stefangabos-zebra-database)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1815.7k12](/packages/popphp-pop-db)[riverside/php-orm

PHP ORM micro-library and query builder

111.3k](/packages/riverside-php-orm)

PHPackages © 2026

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