python - use django create database scheme or use powerdesigner create database scheme -


i ready start new project django,and invloves operations database.i have 2 way scheme:

  1. use powerdesigner design database scheme , output sql,then use python manage.py inspectdb generate models.
  2. design model use python manage.py makemigrations , python manage.py migrate database scheme.

does explain 2 ways' difference , how should choose?

from inspectdb's documentation:

use if have legacy database you’d use django. script inspect database , create model each table within it.

its better if have working db , want use django on it. has limitations like:

  1. if inspectdb cannot map column’s type model field type, it’ll use textfield , insert python comment 'this field type guess.' next field in generated model.
  2. if database column name python reserved word (such 'pass', 'class' or 'for'), inspectdb append '_field' attribute name. example, if table has column 'for', generated model have field 'for_field', db_column attribute set 'for'. inspectdb insert python comment 'field renamed because python reserved word.' next field.

also shortcut method, not recommended if starting django project.

also writing models, running makemigration , migrate command create database scheme containing custom fields such :

auth_group                                auth_group_permissions                    auth_permission                           auth_user                                 auth_user_groups                          auth_user_user_permissions       

which essential django system if want use authentication backend, user model etc core parts of django.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -