40 lines
2.2 KiB
Markdown
40 lines
2.2 KiB
Markdown
# Db2 LUW schema and migrations
|
|
|
|
The Stage 5 tests use the configured `db2_local` connection. They create randomly named
|
|
tables and a separate migration history table, then remove them. A skipped test means
|
|
the connection was unavailable and provides no Db2 verification.
|
|
|
|
```sh
|
|
APP_ENV=testing php artisan test --do-not-cache-result tests/Feature/Db2/SchemaTest.php
|
|
APP_ENV=testing php artisan test --do-not-cache-result tests/Feature/Db2
|
|
APP_ENV=testing php artisan test --do-not-cache-result
|
|
```
|
|
|
|
The tests cover table creation, same-schema rename, conditional drop, adding and
|
|
dropping columns, widening VARCHAR, catalog defaults and identity metadata, composite
|
|
ordinary and unique index metadata and removal, foreign-key metadata and removal,
|
|
and Laravel migration registration and rollback.
|
|
|
|
## Limits
|
|
|
|
- Db2 applies its own rules to type conversions and dependent objects. Table
|
|
renames require the source and target to be in the same schema. Tables with
|
|
certain dependencies, including referential constraints, cannot be renamed.
|
|
- Dropping columns and some type or nullability changes can leave a table in
|
|
REORG-pending state. The driver does not run administrative utilities. Arrange
|
|
for a Db2 administrator to run REORG before subsequent operations that require it.
|
|
- Changing an identity column through Laravel's `change()` is unsupported.
|
|
Unsigned types, column positioning, expression indexes, full-text indexes
|
|
and spatial indexes are outside this implementation.
|
|
- Laravel `unique()` creates a Db2 unique index. Db2 foreign keys require a
|
|
referenced primary key or unique constraint. A standalone unique index does
|
|
not establish that constraint. Foreign-key actions must be supported by Db2
|
|
for the chosen operation.
|
|
- Column defaults are returned as SQL expressions from the catalog. Catalog
|
|
output does not reconstruct generated expressions or every Db2 type attribute.
|
|
- Laravel migration rollback runs `down()` and removes its history entry.
|
|
The driver does not advertise transactional schema migrations.
|
|
- Migration batch lookup casts query-builder `max('batch')` results to text so
|
|
Laravel can perform numeric arithmetic through PDO_ODBC. This applies to custom
|
|
migration history table names as well.
|