自动生成续集模型 [英] auto-generate models for sequelize

查看:26
本文介绍了自动生成续集模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开始使用 Sequelize,这是一个允许在 node.js 中对 mysql 进行 ORM 的模块.我想知道是否可以像 CakePHP 那样自动生成模型.在 CakePHP 中,它将读取表的信息,并在模型中自动创建关联和字段及其类型.我真的不想手工完全绘制我的所有表格,因为有些表格相对较大.有什么东西可以为我做到这一点吗?还是我自己手动输入所有模型?

I'm wanting to start using Sequelize, a module that allows ORM for mysql in node.js. I was wondering if it's possible to auto-generate the models like CakePHP does. In CakePHP, it will read the table's info, and automatically create the associations and fields with their types in the model. i'd really hate to have to completely map out all my tables by hand, as some are relatively large. Is there something out there that will do this for me? Or am I on my own to hand-type all the models out?

推荐答案

您可以通过 sequelize-auto 自动生成模型.只需按照以下链接https://github.com/sequelize/sequelize-auto

You can auto generate models through sequelize-auto. Just Follow the following link https://github.com/sequelize/sequelize-auto

它将生成您的表的模型.

It will generate models of your table.

这篇关于自动生成续集模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆