在Zurmo中有一条命令,是用来更新数据库的。英文描述如下:
在 Markdown 中,用 < 来转义输出 < 这个符号。
USAGE
zurmoc updateSchema <username> <overwriteExistingReadTables>
DESCRIPTION
This command runs an update on the database schema. It calls the InstallUtil::runutoBuildUpdateSchemaCommand.
PARAMETERS
*username: username to log in as and run the impot processes. Typically 'super'.This user must be a super administrator.
*overwriteExistingReadTables: If set to 1 all read tables would be regenerated,which could be a time consuming process.If not set, or set to 0,any existing read tables would be skipped .Defaults to 0.
命令语法如上,就不再说了。
在 ..app/protected/commands/ 在这个目录下执行
1.作用是根据你写的代码去更新数据库,比如你建了一个model,然后在model里写了一些字段,如果还有relations(1个)话,要多对多的关系,执行完这条命令之后,数据库就会生成你那个model的名字的表还有一张多对多的表。
2.如果是你在执行这条命令自己建了表的话,那么这条命令也会去检查你的表有没有问题,有问题会报错。同时如果你的代码有问题(你自己没有发现),但是你运行页面又正常的话,这条命令也可以帮你检查出来的。
3.以后我们可以不用去数据库里建表了,直接在代码中写好,到时候直接运行这条命令就行了,不用担心表与表的关系,因为Zurmo的所有表在数据库中都是没有关联,都是通过代码层面去实现表与表之间的关系的。
(PS:你用Workbench 或者 Navicat 反向工程导出数据库的E-R图就可以发现了)
如有不对请指正!也欢迎有新的见解,我发现的可能也不是这条命令的全部作用。