Download the PHP package enlivenapp/migrations without Composer

On this page you can find all versions of the php package enlivenapp/migrations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package migrations

Stable? Not Quite Yet License PHP Version Monthly Downloads Total Downloads GitHub Issues Contributors Latest Release Contributions Welcome

Migrations Library

I noticed folks downloading some of these packages. I'm super grateful, Thank You! I would like to let folks know until this notice disappears I'm doing a lot of breaking changes without worrying about them. Once versions are up around 0.5.x things should settle down.

Migrations is a single-package standalone PHP library for database migrations and seeds with minimal requirements. It tracks changes applied to your database and runs new ones in order. No framework required, just a database connection. MySQL and MariaDB supported currently. Optional CLI support is available through the flightphp/runway CLI.

Requirements

Recommended:

Data Saver

The data saver automatically attempts to protect every migration against partial failure. Non-destructive changes are repaired by running the opposite operation. For destructive changes, tables are temporarily copied before the operation. If the migration fails, everything is reverted to the pre-migration state.

Quick notes:

If you're familiar with Phinx/CakePHP you'll find the fluent chain very familiar. Codeingiter and Sympony users will find these fairly intuitive. Laravel... o_0 :D

PRs and contributions are welcome.

Supported Frameworks

Install

Full functionality:

Default Paths/Settings

By default Migrations look in:

and seeds expects a return array from:

Configuration

Migrations resolves its own database connection and does not continue looking after it finds one. You never pass it a PDO. The cascade is:

  1. FlightPHP (only if loaded): Flight::get('db') is checked for a PDO. If found, Flight::get('migrations') is used as the config override and no file is read.
  2. File: app/config/migrations.php — flat database credentials plus an optional migrations key of overrides. This is the only config file.
  3. Nothing found → Migrations throws.

Every key except paths and seeds.paths merges recursively, so you only need to set what you want to change. Those two lists are governed by path_mode (below).

app/config/migrations.php:

path_mode — controls how the override paths / seeds.paths lists are combined with the defaults. It applies to both lists using one setting:

Value Behavior
replace The override list replaces the whole default list.
add The override list is appended to the defaults (deduplicated).
keys Legacy positional merge (the default). Deprecated — a future release will make replace the default. Set path_mode explicitly.

If the override does not include paths or seeds.paths, the defaults are kept.

Important Notes:

Additional configuration

Two optional keys let you seed and track code that isn't a composer package (for example, a host app's own migrations under app/Database/Migrations). Both live under the migrations key in your config.

versions — a map of moduleName => version. When a package has no entry in composer/installed.json (core and non-composer code aren't composer packages), this is the version used for seeding. If neither this map nor installed.json resolves a version, the package's install seed block runs once with 0.0.0 as the version.

module_names — maps a migration path pattern to a module name. By default a directory like app/Database/Migrations is derived as the basename Migrations. Use this to give it a real identity (e.g. pubvana/pubvana) so its seeds/migrations are tracked under that name.

Setting Up Migrations

Migrations resolves the database connection itself, so you never pass it a PDO.

Quick Migration file example

Run with runway Run it:

Or run everything:

See below for programatic usage

Reversible migrations

Instead of writing up() and down() separately, you can write change(). The library records what change() did and reverses it automatically on rollback.

Only forward operations are auto-reversible: create table, add columns, rename table, rename column. If your migration drops or modifies things, use up() and down().

CLI commands

Command Description
migrate:all [--dry-run] Run all pending migrations
migrate:single <package> [--dry-run] Run migrations for one package
migrate:make <Name> <package> [rootNamespace] [--path] Create a new migration file
migrate:rollback [--module=NAME] [--dry-run] Roll back the last batch
migrate:status Show what's been run and what's pending
migrate:breakpoint <version> <package> [--clear] Set or clear a rollback breakpoint
migrate:unlock [--dry-run] Force-release the lock after a crash
migrate:purge <package> [--dry-run] Drop a package's tables (destructive, asks for confirmation)

--dry-run shows what would happen without applying any changes. The SQL for create, drop, and alter is captured without running, and seeds are skipped. Nothing is written to the database.

Seeds

Seeds are optional. If you have need of seeding the database use the process below:

Every row gets created_at and updated_at set to the current time on insert, so the target table needs those two columns.

Non-composer packages (core, local plugins): packages without a resolvable version in composer/installed.json (and no migrations.versions entry) run their install block once with 0.0.0 as the version, so the default data is inserted and the row is tracked. Seeds use INSERT IGNORE, so rows that already exist are silently skipped rather than erroring, so running seeds twice is safe.

Running Migrations Programatically

If your brain hurts after reading this like mine did writing it, please consider Flight School Plugin Manager it manages all of this automatically for FlightPHP plugins.

Documentation

License

MIT. See LICENSE.


All versions of migrations with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-pdo Version *
ext-pdo_mysql Version *
composer/semver Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package enlivenapp/migrations contains the following files

Loading the files please wait ...