database - Data modeling question -
my clients use 1 of following when sign application:
- foo api (requires "auth_key", "password", "email")
- acme api (requires "secure_code", "username", "password")
- bar api (requires "xyz_code", "pass_key")
(fake names, , 15 more omitted simplicity)
i prefer not have 10-15 tables in database different api integration options offer (particularly when they're same thing , choose 1 whole list).
my solution this:
make api_configuration table column called api_name holds code specific api (e.g. "foo_api")
make table called credentials_attribute foreign key api_configuration, column called name, , column called value.
then build ui choosing api. if choose acme api, it'll ask "secure_code", "username", , "password", , create row in credentials_attribute each of name/value pairs.
on orm model api_configuration can make method looking credentials_attribute values based on current api_name.
does solution feel right, or there way it, if had model solution problem? please explain rationale (ie, better performance, etc)
if understand case correctly, looks yet case of gen-spec design pattern. "generalization specialization relational modeling".
tutorials on object modeling cover gen-spec, tutorials on relational modeling not. it's understood, , there excellent articles on web.
Comments
Post a Comment