drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Ability to customize the migrations folder on Cloudflare Durable Objects
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
# Summary
Since Cloudflare Durable Objects only allow us to have one SQLite instance per Durable Object, we are forced organize our data such that all belongs to this single database, even if that wouldn't be the ideal architectural decision.
To solve this we should allow the migration code to take the migration table as a parameter so that we can support multiple migration tables in a single Durable Object.
## Exemplification of the Problem
For example:
- Say you have a team of developers that work on everything related to `Events`
- And another team of developers that work on everything related to `Auth`
In an ideal architecture, these teams would have their own [use whatever modularization term you prefer] and they would be able to isolate the complexity and context of the code to only the domain they work on.
Unfortunately, if we're using Durable Objects, that all must be stored in a single SQLite database. So instead of each of these dev teams having their own database to manage, they now need to work on the same database and define their scope based solely on which database **_tables_** each team is responsible for.
Drizzle could facilitate that by allowing each of these two teams to maintain their own Drizzle definitions and migrations.
This is actually pretty easy to do, we just need to allow the `migrate(...)` function from `drizzle-orm/durable-sqlite/migrator` to support `migrationsTable?: string` as a parameter (similar to how other implementations of `migrate(...)` already work).
Contributor guide
Assessment
This issue has not been assessed yet.