Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
odan authored Apr 10, 2017
1 parent a5cd704 commit cc18588
Showing 1 changed file with 50 additions and 49 deletions.
99 changes: 50 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,57 @@ Phinx "only" generates a empty class with up and down functions. You still have

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.

Generated migration
## Features

* Framework independent
* DBMS: MySQL
* Initial schema, schema diff
* 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, constraint name

## Install

Via Composer

```
$ composer require odan/phinx-migrations-generator
```

## Usage

### Generating migrations

On the first run, an inital schema and a migration class is generated.
The `schema.php` file contains the previous database schema and is getting compared with the the current schema.
Based on the difference, a Phinx migration class is generated.

Linux
```
$ vendor/bin/phinx-migrations generate
```

Windows
```
call vendor/bin/phinx-migrations.bat generate
```

By executing the `generate` command again, only the difference to the last schema is generated.

## Parameters

Parameter | Values | Default | Description
--- | --- | --- | ---
--name | string | | The class name.
--overwrite | bool | | Overwrite schema.php file.
--path <path> | string | (from phinx) | Specify the path in which to generate this migration.
--environment or -e | string | (from phinx) | The target environment.

### Generated migration (example)

File: 20170410194428_init.php
Filename: `20170410194428_init.php`

```php
<?php
Expand Down Expand Up @@ -76,53 +124,6 @@ class Init extends AbstractMigration
}
```

## Features

* Framework independent
* DBMS: MySQL
* Initial schema, schema diff
* 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, constraint name

## Install

Via Composer

```
$ composer require odan/phinx-migrations-generator
```

## Usage

### Generating migrations

On the first run, an inital schema and a migration class is generated.
The `schema.php` file contains the previous database schema and is getting compared with the the current schema.
Based on the difference, a Phinx migration class is generated.

Linux
```
$ vendor/bin/phinx-migrations generate
```

Windows
```
call vendor/bin/phinx-migrations.bat generate
```

By executing the `generate` command again, only the difference to the last schema is generated.

## Parameters

Parameter | Values | Default | Description
--- | --- | --- | ---
--name | string | | The class name.
--overwrite | bool | | Overwrite schema.php file.
--path <path> | string | (from phinx) | Specify the path in which to generate this migration.
--environment or -e | string | (from phinx) | The target environment.

### Running migrations

Expand Down

0 comments on commit cc18588

Please sign in to comment.