Skip to content

Commit

Permalink
Merge pull request #279 from CakeDC/develop
Browse files Browse the repository at this point in the history
merge develop branch
  • Loading branch information
steinkel authored Oct 4, 2016
2 parents cbe3137 + 63f6f0f commit e41c7d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
6 changes: 6 additions & 0 deletions Console/Command/MigrationShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ public function run() {

$this->out(__d('migrations', 'All migrations have completed.'));
$this->out('');

Configure::write('Cache.disable', false);
Cache::clear(false, '_cake_model_');

return true;
}

Expand Down Expand Up @@ -438,6 +442,8 @@ protected function _promptVersionOptions($mapping, $latestVersion) {
* @return void
*/
public function generate() {
Configure::write('Cache.disable', true);

$fromSchema = false;
$this->Schema = $this->_getSchema();
$migration = array('up' => array(), 'down' => array());
Expand Down
24 changes: 2 additions & 22 deletions Docs/Documentation/Migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,11 @@ The ```rename_field``` directive changes the name of a field on a specified tabl
Alter Index
-----------

In order to add a new index to an existing field, you need to drop the field and create it again passing the index definition in an array.
In order to add a new index to an existing field, you need to pass the index definition in an array.

```php
'drop_field' => array(
'posts' => array(
'title'
)
),
'create_field' => array(
'posts' => array(
'title' => array(
'type' => 'string',
'length' => 255,
'null' => false
),
'indexes' => array(
'UNIQUE_TITLE' => array(
'column' => 'title',
Expand All @@ -210,25 +200,15 @@ In order to add a new index to an existing field, you need to drop the field and
)
```

Likewise, if you want to drop an index, then you need to drop the field including the indexes you want to drop, then create the field again.
Likewise, if you want to drop an index.

```php
'drop_field' => array(
'posts' => array(
'title',
'indexes' => array(
'UNIQUE_TITLE'
)
)
),
'create_field' => array(
'posts' => array(
'title' => array(
'type' => 'string',
'null' => true,
'length' => 255
)
)
)
```

Expand Down

0 comments on commit e41c7d2

Please sign in to comment.