关于数据库设计和其他因素,以下选择中的哪一个更好。
选项1)
class Profile(Model):
name = CharField(...)
family_name = CharField(...)
passport_number = CharField(...)
ielts = ForeignKey(Ielts)
education = ForeignKey(Education)
class Ielts(Model):
reading = CharField(...)
writing = CharField(...)
spekaing = CharField(...)
listening = CharField(...)
Education(Model):
level = CharField(...)
class Document(Model):
profile = ForeignKey(Profile)
ielts_pic = FileField(...)
passport_pic = FileField(...)
education_transcript_doc = FileField(...)
选项2)
class Profile(Model):
name = CharField(...)
family_name = CharField(...)
passport_number = CharField(...)
passport_pic = FileField(...)
ielts = ForeignKey(Ielts)
education = ForeignKey(Education)
class Ielts(Model):
reading = CharField(...)
writing = CharField(...)
spekaing = CharField(...)
listening = CharField(...)
ielts_pic = FileField(...)
Education(Model):
level = CharField(...)
education_transcript_doc = FileField(...)
如果Model(表)的数量很大怎么办?
最好将文件(从技术上来说,文件地址)分发到与其模型相关的不同表中,或者将它们全部收集在其他文档模型中,并对文档模型的每个字段使用外键分别指向其{{1} }?