Looking for a scalable, flexible, and fast database design for a “Create your own form” style website — for example, Wufoo .
Rules:
- The user has only 1 form that they can build.
- User can create his own fields or choose from standard fields
- User 1 The form has as many fields as the user wants.
- Values may be a brother of a different meaning. For example, the value of a photo can have a name, location, width, height as values for marriage.
Special Rules:
- The user can send his form a maximum of 5 times a day.
- Date value is important
- The flexibility of presenting reports (for one user, for all users, for one field, for many fields) is very important - data visualization (most of them will be based on a chronological order, for example, on all photos for July 2009 for all users).
Table "users"
UID
Table "field_user" - assign a field to user form
Fid
UID
weight - int - is used to order fields in the user form
Fields table
Fid
creator_uid - int - creator field
label - varchar - for example. Email
value_type - varchar - is used to determine which field in the value table will be filled (for example, if "int", then the values of this field will send data to the values.type_int field - and all other fields .type_x will be NULL).
field_type - varchar - . "email" - , .
"values"
VID
parent_vid
FID
UID
-
date_group - int-value 1-5 ( 5 )
type_varchar - varchar
type_text -
type_int - int
type_float - float
type_bool - bool
type_date - date
type_timestamp -
, , "" 1 .type_x, NULL... " " ( , )