0

We have a web application that we're refactoring. We want to make an environment per version with different users (companies) that share the same codebase.

It know this is a somewhat simple question but I just want to make sure we make the right decision (according to webapp best practice).

Say companya.webapp.com points to /1.00/public
and companyb.webapp.com points to /1.30/public

I'm wondering what the best way is to store custom data from these users. Custom data could be uploaded documents, photos and also generated static data like PDF documents/invoices.

When I migrate a user to a different version I want his data to be available in the other version too. The documents also have a record in the database with the path description.

Would it be OK to do something like this structure:

/data/[companyname]/pictures
/data/[companyname]/documents
/data/[companyname]/documents/pdf
/data/[companyname]/documents/csv
/1.00/public

tomvo
  • 1,409
  • 1
  • 12
  • 21
  • Do you have one schema per company? Or do they share the same schema? – liquorvicar Nov 08 '11 at 11:25
  • my intention is to use a different schema per company. So every company has it's own DB. DB selection is based on subdomain. – tomvo Nov 08 '11 at 11:28
  • Your suggestion would work fine. You might want to look at different ways of structuring your files, either within each [companyname] dir or within the /data dir (assuming your app does the access controls). See http://stackoverflow.com/questions/191845/how-to-store-images-in-your-filesystem for some ideas. – liquorvicar Nov 08 '11 at 11:54

1 Answers1

1

Sure, use whatever structure you like. There's no real "correct" answer, and it's very hard to do it wrong. Just make sure the permissions are properly set, so that each company can't read each other's files.

Polynomial
  • 27,674
  • 12
  • 80
  • 107