spree_shared
spree_shared copied to clipboard
Use `Apartment::Tenant.drop` instead of raw SQL
This PR changes the TenantInitializer
to use Apartment::Tenant.drop
instead of the raw DROP SCHEMA IF EXISTS #{db_name} CASCADE
SQL, which only works for PostgreSQL.
This allows the task to be used with MySQL (which has no CASCADE
option), SQLite3 (which "drops databases" by deleting the DB file), and other adapters supported by apartment, besides PostgreSQL.
Fixes #13.
I also think that the task shouldn't drop existing tenants by default, but only if the user passes a "force" flag. But this is a separate issue.