Michael Bethencourt (3 minute read) September 16 2020
Are you a novice or intermediate web developer, starting a brand new project that uses a database? Not sure where to begin in terms of your table design (schema) or ORM models? I've advised quite a few students on this exact topic before, so I assembled these tips as a "check list" to use when you are designing your database:
BlogPost, etc). The methods (functions) should be the "verbs" (e.g.
update_messages) and the properties (columns) should be adjectives or relationships (e.g.
colorfor adjectives, or
creatorfor a relationship)
categoryfield to distinguish them. Another example: Don't have
books_horroras your tables, instead just have a
bookstable and have
genrebe a column.
Tweetmight have many
Userauthor -- but unless that feature is a "must have" for your product now, start with each
Tweethaving only one
User(One to Many or 1:n) until you finish other aspects of your software. Keep your product's design short and sweet. Most software products won't ever even get used, let alone improved upon.
Bonus (Django specific) rule: Avoid "Generic Foreign Keys" if you can!
Continue your coding journey with Kickstart Coding's unique online program.
Apply now and "audit" a video class for free!
Kickstart Fundamentals - 1.1 - HTML