Support for MySQL and PostgreSQL #194
Replies: 5 comments 7 replies
-
|
Hi, When you say “running the test suite,” do you mean adding the gem to our existing app and running our own tests against it, or spinning up a new Rails app that uses the gem and running the gem’s test suite? |
Beta Was this translation helpful? Give feedback.
-
|
Just a small update: I merged #204 by @andrewmarkle today, which takes the first big step of isolating the SQLite-specific code. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! I've spent countless of hours thinking about and trying to come up with a clean solution to multi-tenancy in our Rails application, from the database layer to the application layer. It is really exciting to see this functionality coming to Rails. I did a test with @andrewmarkle's The two biggest problems I've encountered when implementing our current multi tenancy solution is how to make sure every framework in Rails as well as any third party library we use respects the boundaries and works like Rails does in single tenancy. It brings me relief to see that this project aims to resolve the first one and I see similarities on how we solved it. What worries me a bit is the third party libraries. We use a few libraries that inherits from ActiveRecord::Base and we also have a fail safe similar to As an example, we use the Mobility gem and one way of making it work in our current multi tenancy solution and with active-record-tenanted is to find and make sure we add the multi tenancy logic like I wonder what your thoughts are on the vast number of existing libraries that are not active-record-tentanted-aware? Is it up to the user to find the correct monkey patch to make the library work? Is it up to library authors to make sure their library is tenant aware in the future since this will be a part of Rails? Maybe both? Maybe something else? Thanks for all the hard work on this. I will happily continue to test and contribute. |
Beta Was this translation helpful? Give feedback.
-
|
Looking into this problem now for a project that requires data isolation and found this. We're on postgresql so i'll give this a shot to see how well it works with that. |
Beta Was this translation helpful? Give feedback.
-
|
Hey team, Apologies if this is an obvious question, but when discussing support for Postgres, is the main approach that people have in mind to use a separate database for each tenant, or is it likely there would also be support to use a separate schema for each tenant (within a shared database)? The ActiveRecord production:
<<: *default
host: some-host.com
port: 5432
username: postgres
password: <%= ENV['PASSWORD'] %>
schema_search_path: %{tenant}
tenanted: trueOr just setting a tenant-specific I don't have a strong sense of potential security implications, even if this approach were viable - I assume that Do others with more experience have a general sense whether an architecture of separate DB schemas in a shared database could become a viable development path with this gem or:
Thanks for any insights you can offer! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Hi, everybody!
I've had a few chats with people who are interested in support for MySQL and PG. Notably there's been
So I wanted to tag you all and try to bring everybody together to chat a bit.
SQLite was the first database supported simply because that's where I currently have a fast feedback loop. There's no technical reason that I know of that would prevent the gem running against other database.
In summary, the only sqlite-specific bits are create/destroy (plus a file lock around migration to address race conditions), which should all get moved upstream into the Rails adapter.
In the meantime, though, I think we can start testing against PostgreSQL and MySQL (I'm most concerned about race conditions) and see what breaks. Has anybody tried running their test suite or an app in development yet?
Beta Was this translation helpful? Give feedback.
All reactions