Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions docs/en/appendices/5-4-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ version is reported as `unknown`), the header is omitted.
See [Query Builder](../orm/query-builder#advanced-conditions).
- Added `inOrNull()` and `notInOrNull()` methods for combining `IN` conditions with `IS NULL`.
- Added `isDistinctFrom()` and `isNotDistinctFrom()` methods for null-safe comparisons.
- Added PostgreSQL index access method reflection. Non-btree indexes (`gin`,
`gist`, `spgist`, `brin`, `hash`) are now reflected with an `accessMethod`
field and regenerated with the correct `USING` clause. The `Index` class
provides constants (`Index::GIN`, `Index::GIST`, `Index::SPGIST`,
`Index::BRIN`, `Index::HASH`) for these access methods.
See [Reading Indexes and Constraints](../orm/schema-system#reading-indexes-and-constraints).

### I18n

Expand Down
22 changes: 22 additions & 0 deletions docs/en/orm/schema-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,28 @@ $indexes = $schema->indexes()
$index = $schema->index('author_id_idx')
```

#### PostgreSQL Index Access Methods

::: info Added in version 5.4.0
:::

When reflecting indexes on PostgreSQL, non-btree indexes include an
`accessMethod` field identifying the underlying index type (`gin`, `gist`,
`spgist`, `brin`, `hash`). Schemas generated from these reflections will emit
the appropriate `USING` clause when recreating the index.

```php
$schema->addIndex('articles_tags_idx', [
'columns' => ['tags'],
'type' => 'index',
'accessMethod' => 'gin',
]);
```

The `Cake\Database\Schema\Index` class exposes constants for the supported
access methods: `Index::GIN`, `Index::GIST`, `Index::SPGIST`, `Index::BRIN`,
and `Index::HASH`. Btree indexes (the default) omit the `accessMethod` field.

### Adding Table Options

Some drivers (primarily MySQL) support and require additional table metadata. In
Expand Down