Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a new database from within a Rails app?
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COI was going to do this and took a lot of flack from the rails community :) Ultimately I decided not to. My plan of attack was that I would dynamically adjust the table name (using set_table_name). Trouble is that since table_name is at the class level, changing the table_name on one instance changes the table_name for all instances. That's as far as I got. I had considered adding a table_name instance variable as opposed to a class variable. Ultimately, it was migrations that scared me off. Curious to see if you come up with anything.
      singulars
      1. This table or related slice is empty.
    2. COI'm going with the one-database-per-account method because I don't expect to have that many accounts and some of them can have several million records, so I think it definitely makes sense for me. I've actually had no trouble thus far in actually running the app. I just have a before_filter that hijacks the DB connection using establish_connection based on the account subdomain. Works like a charm -- but I do want a way to run migrations (or the equivalent) so I don't have to create each account manually!
      singulars
    3. COI'd be interested to know a bit more about why you'd have separate (and a dynamic number of) databases per user account. If you've got a very high level of data and that's why, then you'd probably want to look at a sharding type approach (no dynamic number of tables, but customer accounts are spread across servers). That way your migrations when you *will* change your schema later on are as normal, but done on all your db servers. If your reasoning for multiple db's is for customer separation, or partitioning for convenience, or speed of queries, the reasoning sounds a little more shaky there
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload