CakePHP能自动从模型创建表吗? [英] can CakePHP automatically create tables from models?

查看:126
本文介绍了CakePHP能自动从模型创建表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在python :: Pylons中,我可以发出一个setup-app命令,它将查看我的模型并为我的特定数据库发出相应的CREATE TABLE或CREATE INDEX ddl。

In python::Pylons i'm able to issue a setup-app command and it will look at my Models and issue the appropriate CREATE TABLE or CREATE INDEX ddl for my particular database.

似乎这将是CakePHP中的一个功能,但我无法找到它。

it seems like this would be a feature in CakePHP, but i'm having trouble finding it.

其实我在手册中看到这个:
您可以像平常一样创建数据库表。创建Model类时,它们将自动映射到您创建的表。

in fact i see this in the manual: "You can create your database tables as you normally would. When you create your Model classes, they'll automatically map to the tables that you've created."

这导致我相信它不存在?

which leads me to believe it doesn't exist?

推荐答案

不,它的另一个方法 - 你可以创建模型,控制器和视图通过具有DB模式。

No, it's other way around - you can create models, controllers and views by having DB schema. It's more logical to have a DB design schema first.

检查 this out

这篇关于CakePHP能自动从模型创建表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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