简体   繁体   中英

How do I go from a MySQLWorkbench EER model (ERD) to Django?

I designed a database using MySQLWorkbench EER model with many foreign key relationships and tables using Django default naming conventions (like using id for primary keys, *_id for foreign keys). Now that I feel that I have a good back-end design, how do I convert that into a Django Python code for models.py ? Do I have to manually type out every table?

I read that there is already a UML to Django conversation and I also know MySQLWorkbench can export and "Forward Engineer SQL CREATE script". But I'm not sure if MySQLWorkbench can export a UML diagram.

Also another question, I have an order table that has 3 foreign keys to the user table. The three foreign keys are user_created , user_modified , and user_status . I know that normally Django would create a foreign key called user_id , but what if I need three distinct foreign key from one table?

这是旧文章,但是这里是一个MySQL Workbench模块,用于导出Django模型。pyhttp: //sourceforge.net/p/mysqlworkbenchdjangomodule

但是您可以使用“ Forward Engineer SQL CREATE脚本”,然后按照此线程中的描述进行操作: 是否可以从数据库中生成Django模型?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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