hyperf / hyperf/migration-generator-incubator

字段类型TIME迁移错误 - `migration-generator-incubator` Fails to Generate Migration for Tables with `TIME` Columns

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
6
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Description
When running `php bin/hyperf.php gen:migration-from-database` to generate migrations from an existing MySQL database, the tool fails to process tables containing `TIME` columns, throwing the error: `[ERROR] Created Migration: The type of time cannot be supported`. This prevents generating migration files for affected tables, such as `xxx_table`, which uses `TIME` columns like `checkin_start_time` and `checkin_end_time`. This issue blocks automated migration generation in CI/CD pipelines.

## Steps to Reproduce
1. Set up a Hyperf project with `hyperf/migration-generator-incubator` installed (`composer require hyperf/migration-generator-incubator --dev`).
2. Configure a MySQL database connection in `config/autoload/databases.php` or `.env`.
3. Create a table with `TIME` columns, e.g.:
```sql
CREATE TABLE `xxx` (
xxxx
`checkin_start_time` time NOT NULL COMMENT 'Earliest check-in time',
`checkin_end_time` time NOT NULL COMMENT 'Latest check-in time (late threshold)',
xxxx
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='xxx';
4.Run the migration generator command
`php bin/hyperf.php gen:migration-from-database`
5.Observe the error: [ERROR] Created Migration: The type of time cannot be supported.

## Environment

- Hyperf Version:3.1.0
- PHP Version:8.1
- Database:5.7.44-log
- Package Version:0.4.3

## Additional Information
- The issue occurs specifically for tables with TIME columns. Other types (e.g., BIGINT, VARCHAR, TIMESTAMP) work fine.
- Workaround: Manually create migration files using $table->time() for TIME columns, but this defeats the purpose of automated migration generation.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.