数据库设计
时间:2021-07-01 10:21:17
帮助过:6人阅读
连表有性能消耗 (1):连表设计: 方式一: class UserType(models.Model): """ 用户类型表,个数经常变动 """ title = models.CharField(max_length=32) class UserInfo(models.Model): """ 用户表:讲师和班主任 """ username = models.CharField(max_length=32) password = models.CharField(max_length=64) email = models.CharField(max_length=32) ut = models.ForeignKey(to="UserType") 方式二: - choices # class UserInfo(models.Model): # """ # 用户表 # """ # username = models.CharField(max_length=32) # password = models.CharField(max_length=64) # email = models.CharField(max_length=32) # # user_type_choices = ( # (1, ‘班主任‘), # (2, ‘讲师‘), # ) # # user_type_id = models.IntegerField(choices=user_type_choices)数据库设计
标签:讲师 microsoft inf har type 性能 数据库 for 数据