简体   繁体   English

使用codeignituer db forge创建表。 自动化代码?

[英]creating a table with codeignituer db forge. automate code?

Is there a way to take an existing mysql create table String, and turn it into a db_forge array/script suitable for the create_table() method?, ie basically reverse the dbforge process. 有没有办法采用现有的mysql创建表String,然后将其转换为适合create_table()方法的db_forge数组/脚本?即从根本上反转dbforge进程。 It is just quicker to make tables in something like Sequel pro, then copy the sql code to the model. 使用诸如Sequel pro之类的表来制作表,然后将sql代码复制到模型中,这样更快。

I already have the mysql code, but i was thinking of using the dbforge to allow different databases to be used. 我已经有mysql代码,但是我正在考虑使用dbforge允许使用不同的数据库。

Do people use the dbforge? 人们使用dbforge吗? or just write the SQL creation code manually? 还是只是手动编写SQL创建代码?

hi if you want to create tables through codeigniter then use migrations class it can solve your problem. 您好,如果您想通过codeigniter创建表,然后使用migrations类可以解决您的问题。 you can create, update and delete table with migrations. 您可以通过迁移创建,更新和删除表。

CI Migration class CI迁移班

There is no automated process to do what you ask. 没有自动化的过程可以完成您所要求的。 You have to convert it manually. 您必须手动将其转换。

I have found that once I became familiar with the dbforge syntax, I can create tables just as quickly, if not quicker, than using Sequel Pro or another SQL GUI. 我发现,一旦我熟悉dbforge语法,就可以像使用Sequel Pro或其他SQL GUI一样快(甚至更快)创建表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM