Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Updated readme with the pg support #23

Merged
merged 2 commits into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# ZfSimpleMigrations

Simple Migrations for Zend Framework 2. Project originally based on [ZendDbMigrations](https://github.com/vadim-knyzev/ZendDbMigrations) but module author did not response for issues and pull-requests so fork became independent project.
Simple Migrations for Zend Framework 2. Project originally based
on [ZendDbMigrations](https://github.com/vadim-knyzev/ZendDbMigrations) but module author did not response for issues
and pull-requests so fork became independent project.

## Supported Drivers
The following DB adapter drivers are supported by this module.

* Pdo_Sqlite
* Pdo_Mysql
* Mysqli _only if you configure the driver options with `'buffer_results' => true`_
The following DB adapter drivers are supported by this module.

* Pdo_Sqlite
* Pdo_Mysql
* Pdo_Pgsql
* Mysqli _only if you configure the driver options with `'buffer_results' => true`_

## Installation

Expand All @@ -18,6 +21,7 @@ The following DB adapter drivers are supported by this module.
php composer.phar require vgarvardt/zf-simple-migrations:dev-master
php composer.phar update
```

add `ZfSimpleMigrations` to the `modules` array in application.config.php

## Usage
Expand All @@ -35,7 +39,7 @@ Generic migration class has name `Version<YmdHis>` and implement `ZfSimpleMigrat

### Migration class example

``` php
```php
<?php

namespace ZfSimpleMigrations\Migrations;
Expand All @@ -60,16 +64,18 @@ class Version20130403165433 extends AbstractMigration
```

#### Multi-statement sql
While this module supports execution of multiple SQL statements it does not have way to detect if any other statement than the first contained an error. It is *highly* recommended you only provide single SQL statements to `addSql` at a time.
I.e instead of

```
While this module supports execution of multiple SQL statements it does not have way to detect if any other statement
than the first contained an error. It is *highly* recommended you only provide single SQL statements to `addSql` at a
time. I.e instead of

```php
$this->addSql('SELECT NOW(); SELECT NOW(); SELECT NOW();');
```

You should use

```
```php
$this->addSql('SELECT NOW();');
$this->addSql('SELECT NOW();');
$this->addSql('SELECT NOW();');
Expand All @@ -80,7 +86,7 @@ $this->addSql('SELECT NOW();');
By implementing the `Zend\ServiceManager\ServiceLocatorAwareInterface` in your migration class you get access to the
ServiceLocator used in the application.

``` php
```php
<?php

namespace ZfSimpleMigrations\Migrations;
Expand Down Expand Up @@ -114,8 +120,8 @@ class Version20130403165433 extends AbstractMigration

### Accessing Zend Db Adapter In Migration Class

By implementing the `Zend\Db\Adapter\AdapterAwareInterface` in your migration class you get access to the
Db Adapter configured for the migration.
By implementing the `Zend\Db\Adapter\AdapterAwareInterface` in your migration class you get access to the Db Adapter
configured for the migration.

```php
<?php
Expand Down Expand Up @@ -155,23 +161,22 @@ class Version20150524162247 extends AbstractMigration implements AdapterAwareInt
}
```


## Configuration

### User Configuration

The top-level key used to configure this module is `migrations`.
The top-level key used to configure this module is `migrations`.

#### Migration Configurations: Migrations Name

Each key under `migrations` is a migrations configuration, and the value is an array with one or more of
the following keys.
Each key under `migrations` is a migrations configuration, and the value is an array with one or more of the following
keys.

##### Sub-key: `dir`

The path to the directory where migration files are stored. Defaults to `./migrations` in the project root dir.

##### Sub-key: `namespace`
##### Sub-key: `namespace`

The class namespace that migration classes will be generated with. Defaults to `ZfSimpleMigrations\Migrations`.

Expand All @@ -183,7 +188,7 @@ Flag to log output of the migration. Defaults to `true`.

The service alias that will be used to fetch a `Zend\Db\Adapter\Adapter` from the service manager.

#### User configuration example:
#### User configuration example

```php
'migrations' => array(
Expand Down