Closed tan1444 closed 5 years ago
这个..没这个功能啊……
只能手码吗?项目里打一遍,再到数据库里手动创建一下?
等等..sequelize有个sync 方法的,可以同步表结构的
在midway框架下如何实现呢,有没有demo?
sequeze是orm框架 orm简化了sql操作前提是,把实体类映射到数据库的表字段,你不自己定义Model,框架不知道怎么处理 。在Java中heberlate也是需要配置文件的,同时也要建立相应的bean,定义类的属性与方法,来映射到数据库。然后就可以用orm框架来简化sql语句,用对应的api来操作数据。
这个属于 sequelize 的用法,具体看同步这页。。http://docs.sequelizejs.com/manual/models-definition.html#database-synchronization
我按照例子定义好了user表,但如何把它同步到我的数据库中去呢?