database - Data modeling question -


my clients use 1 of following when sign application:

  1. foo api (requires "auth_key", "password", "email")
  2. acme api (requires "secure_code", "username", "password")
  3. 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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -