(database design):Which tables should be created for all kindes files (images, attached email files,

Posted by meyosef on Stack Overflow See other posts from Stack Overflow or by meyosef
Published on 2010-05-31T14:54:48Z Indexed on 2010/05/31 15:53 UTC
Read the original article Hit count: 216

Filed under:
|
|

Hi, I new in database design: I have question with my own few solution,what do you thinks?: Which tables should be created for all kinds files (images, attached email files,text files for store email body, etc..) that stored in my online store?

*option 1:use seperate table for files types *

files{
id
files_types_id FK
file_path
file_extension
}

files_types{
id
type_name (unique)
}

*option 2: use bool field for each file type *

files{
id
file_path
file_extension
is_image_main
is_image_icon
is_image_logo
is_pdf_file
is_text_file
}

**option 3: use 1 enum field 'file_type' for each file type **

files{
id
file_path
file_extension
file_type (image_main,image_icon,image_logo,image_main,pdf,text) **enum**
}

Thanks you, Yosef

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database