howyi/conv

从实际数据库和DDL生成MySQL迁移查询

资助包维护!
howyi

v2.1.5 2024-03-21 14:56 UTC

README

Build Status Coverage Status Total Downloads

conv

howyi/conv-laravel的核心包

从实际数据库和DDL生成MySQL迁移查询

composer require howyi/conv --dev

查询示例

tbl_user.sql

CREATE TABLE `tbl_user` (
  `user_id` int(11) NOT NULL COMMENT 'User ID',
  `age` tinyint(3) UNSIGNED COMMENT 'User age',
  PRIMARY KEY (`user_id`),
  KEY `id_age` (`user_id`, `age`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='User management table';

生成的迁移

UP

CREATE TABLE `tbl_user` (
  `user_id` int(11) NOT NULL COMMENT 'User ID',
  `age` tinyint(3) UNSIGNED COMMENT 'User age',
  PRIMARY KEY (`user_id`),
  KEY `id_age` (`user_id`, `age`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='User management table';

DOWN

DROP TABLE `tbl_user`;

贡献

安装

$ composer install

检查(在拉取请求之前)

$ composer check-fix