Skip to content

请求大佬增加 mysql ddl 生成库 #80

Description

@hanwenbo

目前npm 搜索ddl 没找到相关的库
社区有 ddl 2 json的 但是没有 链式操作 生成ddl的库

我目前的需求是根据markdown 生成 msyql的语句建表,因为这样写好文档就相当于写好了mysql

markdown 根据 table 解析为json 已经解决

ddl生成目前采用的 https://github.com/easy-swoole/ddl
不过我觉得生成代码这种工作 放在前端比较好 所以希望社区增加该类型的库

这是我现在用php生成的文件
1.markdown table语法 转为json
2.根据json循环生成 sql文件
3.复制sql内容到Navicat

image

CREATE TABLE IF NOT EXISTS `fa_anubis_order` (
  `id` int(10) UNSIGNED ZEROFILL NOT NULL PRIMARY KEY AUTO_INCREMENT COMMENT 'ID',
  `order_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '订单id',
  `tracking_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '运单id',
  `partner_order_code` varchar(64) NULL DEFAULT NULL COMMENT '外部订单号',
  `serial_number` varchar(64) NULL DEFAULT NULL COMMENT '商家订单流水号',
  `order_status` tinyint(6) UNSIGNED NULL DEFAULT NULL COMMENT '订单状态|ENUM:0:订单生成,1:运单生成成功,20:骑手接单,80:骑手到店,2:配送中,3:已完成,4:已取消,5:配送异常',
  `carrier_driver_id` varchar(64) NULL DEFAULT NULL COMMENT '配送员id',
  `carrier_driver_name` varchar(32) NULL DEFAULT NULL COMMENT '配送员姓名',
  `carrier_driver_phone` varchar(20) NULL DEFAULT NULL COMMENT '配送员电话',
  `estimate_arrive_time` bigint(13) UNSIGNED NULL DEFAULT NULL COMMENT '预计送达时间(毫秒)',
  `overtime_compensation_cost_cent` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '时效赔付',
  `if_can_add_tip` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '调度费支持|ENUM:0:不可以,1:可以',
  `order_tip_amount_cent` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '订单当前小费总金额分',
  `delivery_fetch_photos` varchar NULL DEFAULT NULL COMMENT '骑手取货照片地址',
  `order_total_amount_cent` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '原始配送费金额无需关注',
  `order_actual_amount_cent` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '订单实际配送支付总金额',
  `price_detail` varchar NULL DEFAULT NULL COMMENT '配送费价格明细',
  `abnormal_code` varchar(20) NULL DEFAULT NULL COMMENT '运单异常原因code',
  `abnormal_desc` varchar(255) NULL DEFAULT NULL COMMENT '运单异常原因描述',
  `event_log_details` varchar NULL DEFAULT NULL COMMENT '运单事件节点信息',
  `complaint_id` bigint(20) NULL DEFAULT NULL COMMENT '投诉编号',
  `complaint_reason_desc` varchar(255) NULL DEFAULT NULL COMMENT '投诉原因描述',
  `complaint_status` tinyint(6) NULL DEFAULT NULL COMMENT '投诉状态|ENUM:1:待处理,2:成功,3:失败',
  `claim_id` bigint(20) NULL DEFAULT NULL COMMENT '索赔id',
  `claim_reason_desc` varchar(255) NULL DEFAULT NULL COMMENT '索赔原因描述',
  `claim_status` tinyint(6) UNSIGNED NULL DEFAULT NULL COMMENT '索赔状态|ENUM:1:待处理,2:成功,3:失败',
  `temperature` varchar(20) NULL DEFAULT NULL COMMENT '骑手体温',
  `order_distance` decimal(10,2) NULL DEFAULT NULL COMMENT '配送距离',
  `created_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
  `delete_time` int(10) NOT NULL DEFAULT 0 COMMENT '删除时间'
)
ENGINE = MYISAM DEFAULT COLLATE = 'utf8mb4_general_ci' COMMENT = 'anubis_order';

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions