PHPackages                             yzh52521/migrate-schema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yzh52521/migrate-schema

ActiveLibrary

yzh52521/migrate-schema
=======================

易使用漂亮的数据库迁移代码构建器

v1.0.1(2y ago)322MITPHP

Since Sep 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/yuanzhihai/migrate-schema)[ Packagist](https://packagist.org/packages/yzh52521/migrate-schema)[ RSS](/packages/yzh52521-migrate-schema/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

安装
--

[](#安装)

```
composer require yzh52521/migrate-schema
```

使用
--

[](#使用)

```
// 创建表
Schema::create($this->getAdapter(), '表名', function (Blueprint $table) {
    // 迁移代码
});

// 修改表
Schema::table($this->getAdapter(), '表名', function (Blueprint $table) {
    // 迁移代码
});
```

可用的字段定义方法
---------

[](#可用的字段定义方法)

命令描述$table-&gt;id();定义一个bigint 并命名为id的主键$table-&gt;bigInteger('votes');相当于 BIGINT$table-&gt;binary('data');相当于 BLOB$table-&gt;boolean('confirmed');相当于 BOOLEAN$table-&gt;char('name', 100);相当于带有长度的 CHAR$table-&gt;date('created\_at');相当于 DATE$table-&gt;dateTime('created\_at');相当于 DATETIME$table-&gt;decimal('amount', 8, 2);相当于带有精度与基数 DECIMAL$table-&gt;double('amount', 8, 2);相当于带有精度与基数 DOUBLE (think-migration 3.1.x)$table-&gt;float('amount', 8, 2);相当于带有精度与基数 FLOAT (think-migration 3.1.x)$table-&gt;enum('level', \['easy', 'hard'\]);相当于 ENUM$table-&gt;set('level', \['easy', 'hard'\]);相当于 SET (think-migration 3.1.x)$table-&gt;geometry('positions');相当于 GEOMETRY$table-&gt;integer('votes');相当于 INTEGER$table-&gt;json('options');相当于 JSON$table-&gt;jsonb('options');相当于 JSONB$table-&gt;lineString('positions');相当于 LINESTRING$table-&gt;longText('description');相当于 LONGTEXT$table-&gt;mediumInteger('votes');相当于 MEDIUMINT$table-&gt;mediumText('description');相当于 MEDIUMTEXT$table-&gt;point('position');相当于 POINT$table-&gt;polygon('positions');相当于 POLYGON$table-&gt;smallInteger('votes');相当于 SMALLINT$table-&gt;softDeletes();相当于为软删除添加一个可空的 delete\_time 字段$table-&gt;string('name', 100);相当于带长度的 VARCHAR$table-&gt;text('description');相当于 TEXT$table-&gt;time('sunrise');相当于 TIME$table-&gt;timestamp('added\_on');相当于 TIMESTAMP$table-&gt;timestamps();相当于可空的 create\_time 和 update\_time TIMESTAMP$table-&gt;tinyInteger('votes');相当于 TINYINT$table-&gt;unsignedBigInteger('votes');相当于 Unsigned BIGINT$table-&gt;unsignedDecimal('amount', 8, 2);相当于带有精度和基数的 UNSIGNED DECIMAL$table-&gt;unsignedInteger('votes');相当于 Unsigned INT$table-&gt;unsignedMediumInteger('votes');相当于 Unsigned MEDIUMINT$table-&gt;unsignedSmallInteger('votes');相当于 Unsigned SMALLINT$table-&gt;unsignedTinyInteger('votes');相当于 Unsigned TINYINT$table-&gt;uuid('id');相当于 UUID$table-&gt;year('birth\_year');相当于 YEAR[查看使用示例](./example/20230905140550_test.php)

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

974d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/052aa4acd90ad5d672ae5abe8d27d1f576f9c07e1967e2f6bced03b84079310f?d=identicon)[yuanzhihai](/maintainers/yuanzhihai)

---

Top Contributors

[![yuanzhihai](https://avatars.githubusercontent.com/u/15060466?v=4)](https://github.com/yuanzhihai "yuanzhihai (8 commits)")

### Embed Badge

![Health badge](/badges/yzh52521-migrate-schema/health.svg)

```
[![Health](https://phpackages.com/badges/yzh52521-migrate-schema/health.svg)](https://phpackages.com/packages/yzh52521-migrate-schema)
```

###  Alternatives

[zoujingli/think-library

Library for ThinkAdmin

8569.8k17](/packages/zoujingli-think-library)[jaguarjack/catchadmin

The CatchAdmin Background management

8962.6k](/packages/jaguarjack-catchadmin)[casbin/think-authz

An authorization library that supports access control models like ACL, RBAC, ABAC for ThinkPHP.

27918.5k6](/packages/casbin-think-authz)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
