PHPackages                             elefant/app-migrate - 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. elefant/app-migrate

ActiveElefant-app[Database &amp; ORM](/categories/database)

elefant/app-migrate
===================

Database migrations for the Elefant CMS

181PHP

Since Sep 9Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jbroadway/migrate)[ Packagist](https://packagist.org/packages/elefant/app-migrate)[ RSS](/packages/elefant-app-migrate/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Database Migrations for the Elefant CMS
=======================================

[](#database-migrations-for-the-elefant-cms)

This app provides a database migrations framework for the Elefant CMS, including a simple API for automating migrations as well as a series of command line options for viewing and applying/reverting changes.

**Status: Beta**

Installation
------------

[](#installation)

Copy the `migrate` app folder into `apps/migrate` and run the following command to import the database schema:

```
./elefant import-db apps/migrate/conf/install_mysql.sql
```

> Note: Replace the database driver with the appropriate one for your site.

Usage
-----

[](#usage)

From the command line:

```
# update to the latest revision
./elefant migrate/up myapp\\MyModel

# update to the specified revision
./elefant migrate/up myapp\\MyModel 20130922012345

# revert all revisions
./elefant migrate/down myapp\\MyModel

# revert to the specified revision
./elefant migrate/down myapp\\MyModel 20130922012345

# list all available migrations
./elefant migrate/list

# list all versions of a migration
./elefant migrate/versions myapp\\MyModel

# check which version is current
./elefant migrate/current myapp\\MyModel

# check if the current version is the latest
./elefant migrate/is-latest myapp\\MyModel

# generate a new migration class
./elefant migrate/generate myapp\\MyModel
```

### Defining a new table

[](#defining-a-new-table)

Here is a basic migration that creates a table on `migrate/up` and drops it on `migrate/down`.

```
