Giter VIP home page Giter VIP logo

migrations's Introduction

Migrations

Migrations Builder for Phinx.

Currently Phinx (a migration library) cannot generate migrations automatically. Phinx "only" generates a empty class with up and down functions. You still have to write the migration manually.

In reality, you should rarely need to write migrations manually, as the migrations library "should" generate migration classes automatically by comparing your schema mapping information (i.e. what your database should look like) with your actual current database structure.

Screenshot

Generated migration

Screenshot 2

THIS IS A DEVELOPMENT PREVIEW - DO NOT USE IT IN PRODUCTION!

Features

  • Framework independent
  • DBMS: MySQL
  • Database: character set, collation
  • Tables: create, update, remove, engine, comment, character set, collation
  • Columns: create, update, remove
  • Indexes: create, remove
  • Foreign keys (experimental): create, remove

Not supported

Installation

git clone https://github.com/odan/migrations.git
cd migrations
composer install --no-dev

Integration

composer require odan/migrations

Configuration

  • Default configuration file: migrations-config.php

Example:

<?php

return array(
    'dsn' => 'mysql:host=127.0.0.1;dbname=test',
    'username' => 'root',
    'password' => '',
    'options' => array(
        PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
    ),
    'schema_file' => __DIR__ . '/schema.php',
    'migration_path' => __DIR__
);
Name Type Default Description
dsn string Data source name (mysql:host=127.0.0.1;dbname=test)
username string Database username
password string Database password
options array Database options
schema_file string schema.php Database schema file (schema.php or schema.json)
migration_path string Output directory for migration files

Usage

Generating migrations

cd bin
php migrations.php migration:generate

Load custom config file

php migrations.php migration:generate --config=myconfig.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.