basecamp / basecamp/activerecord-tenanted
After creating the tenanted database the tables are not accessible
- Dominant language
- Ruby
- Stars
- 617
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
The tables inside the tenanted database table can't be accessed right after the tenanted db has been created despite the fact that they've been created on disk.
My pseudocode is like this:
- register the user (create a new user)
- create a tenanted database: `Project.create_tenant tenant_slug`
- switch to tenant of the current_user
-then do the domain specific work within the newly created tenant
The Error:
- ``` ::Payments::BillingInfo.current_tenant: "14d66e" ```
- ```::Payments::BillingInfo.count
eval error: SQLite3::SQLException: no such table: payments_billing_infos:
SELECT COUNT(*) FROM "payments_billing_infos"```
The error otherwise:
```
CoreRecord.with_tenant('14d66e') do Payments::BillingInfo.count end
eval error: SQLite3::SQLException: no such table: payments_billing_infos:
SELECT COUNT(*) FROM "payments_billing_infos"
```
As You can see on the disk the tenanted directory exists:
Even the database exists:
As I open the dataabse file even the table inside the database exists:
Contributor guide
Research direction
Reproduce the flow using Project.create_tenant, tenant switching, and CoreRecord.with_tenant, then query Payments::BillingInfo.count against the newly created SQLite database. Compare the database file and its tables with the connection used by the query. Done means tables in a freshly created tenant are accessible immediately after creation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100