I built an app for a local group who runs frisbee leagues not too long ago. I am wanting to build this out, and make it something that I can provide to other groups.
Jist: people sign up to play, app creates teams, app creates schedules, there are admins for each group who can manage their leagues
The problem is, I have one database, and it was originally set up to only deal with one group's leagues. How would I go about reworking the schema to allow multiple groups to be able to log in and modify only their own leagues.
My thought was to create an "account" table, and tack "account_id" to every table. Is this a good approach? I have attached the schema, so you should be able to see what I have thus far!
Note: I am building this in Codeigniter (php) and MySQL.
Multiple clients; one hosted application. You're describing a multi-tenant database.
When you build a multi-tenant database, you need to consider
Multi-tenant solutions range from one database per tenant (shared nothing) to one row per tenant (shared everything).
"Shared nothing", "separate database", or one database per tenant
"Shared everything", or "shared schema", or "one database per pl.net"
Between "shared nothing" and "shared everything" is "shared schema".
"Shared schema"
Microsoft has a good article on multi-tenant architecture with more details. (The link is to just one page of a multi-page document.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.