GithubHelp home page GithubHelp logo

django_er's Introduction

django_er

  1. generate ER by django modules use mermaid
  2. auto add comment for columns of MySQL or PostgreSQL.the property verbose_name,help_text,choices of the django model will be used as comment for columns

pre use

  1. install the package
pip install git+https://github.com/j5255089/django_er.git
  1. in settings.py add app
INSTALLED_APPS += [
    'django_er',
]

generate ER

python manage.py er -o er.html auth

auth is a app label

then open er.html with web browser

add comment to database

Database Supported

  • MySQL
  • PostgreSQL

How to use

the model

name = models.CharField(max_length=200, verbose_name="名称", blank=True, default=None)
age = models.SmallIntegerField(verbose_name="年龄", blank=True, default=None)

next, type command

python manage.py addcomments

finally, the info will be printed, all the models created will be processed

## MySQL 
-- FOR test_student.name 
        ALTER TABLE test_student
        MODIFY COLUMN `name` varchar(200) COLLATE utf8mb4_bin NOT NULL  COMMENT '名称'
-- FOR test_student.age 
        ALTER TABLE test_student
        MODIFY COLUMN `age` smallint(6) NOT NULL  COMMENT '年龄'

## PostgreSQL
-- FOR test_student.name 
        COMMENT ON COLUMN test_student.name IS '名称'
-- FOR test_student.age 
        COMMENT ON COLUMN test_student.age IS '年龄'

If any bug

you can fix by yourself or commit your issue here, I will fix it

django_er's People

Contributors

codeliuyang avatar j5255089 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.