I'm currently developing an app which will be extendable via "plugins".
the idea is basically the core app will have users and a users table.
now say for example i wanted to add a plugin which adds newsletter signup, or billing to individual users.
im in need of some help regarding how to reflect this in the database.
i see three options:
foreach plugin add a new db table which references the user id
have the core app build a user meta table which plugins can use (i.e. wordpress get/update_user_meta)
allow each plugin to alter the core user table via migrations
this is my dilemma.
pretty simple, but could mean multiple tables with maybe 1,2 columns plus means extra queries when fetching the data for any plugin.
pretty simple again with only 1 extra table, but still multiple queries to access the data
no extra queries, less tables, but my gut is telling me this may be bad practise to suggest plugins should alter core tables.
i will be using eloquent so number 2 can be handled with a has many relationship pretty easily. plus if a plugin was sufficiently large it could still create its own table.
number 3 is what i really want to get peoples views on.
i have another example which may help explain a little better, take jefferys billing tutorials.
say i have a plugin which adds billing for stripe and paypal, but could also have other payment gateways.
the app doesnt know by default this plugin will be used, so the core user table would not have a stripe or paypal subscription id column.
if however the user activates the billing plugin, should the plugin alter the core user table to add a stripe/paypal column?
and if another payment gateway is added should any new columns be added to cater for this.
if we take option 1 we end up with a table that just has user_id|stripe|paypal
with option 2 we have a row in the user meta table like: user_id|stripe_id|value and user_id|paypal_id|value
with option 3 we alter the user table to add two columns strip_id|paypal_id and whenever the user model is accessed the values are already fetched.
any opinions welcome.