Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有办法实现初次部署时自动根据model创建数据表吗? #1490

Open
firendlys opened this issue Jun 2, 2020 · 1 comment
Open

Comments

@firendlys
Copy link

DESC

官方文档中似乎找不到创建数据库和数据表(create table xxx)的方法.
在初次部署的时候,数据库是空的,如何在代码中依据 think.Model::schema() 中定义的表结构自动生成创建表的sql语句并执行呢?
如果需要手写sql语句并执行,又或者需要通过另一种方式先手动在数据库中创建好表格,那么再次在 schema()中定义表结构似乎就重复了.

ENV

OS Platform:

Node.js Version:

ThinkJS Version:
3.x

@lizheming
Copy link
Contributor

这个目前 think-model 中没有提供,你可以使用 think-sequelize 试试,sequelize 是提供自动创建的功能的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants