Replies: 3 comments 3 replies
-
A dialect-agnostic schema would be amazing. This won't prevent you from the need to refactor pieces of code exposed from drizzle that are specific to some dialects or drivers tho. The only case I can think about where a dialect-agnostic schema would be necessary is in case you want to distribute software as DB-agnostic. But a dialect-agnostic schema would also require a driver-agnostic initializer for drizzle and that would be quite a hustle to maintain I assume and it could lead to some unwanted performance overhead maybe? And a dialect-agnostic and driver-agnostic drizzle would lead most developers to default on it (just a speculation tho) which I don't know if it is a good thing. Many databases have very powerful features that are specific to them and agnosticism will likely prevent you from using those features. |
Beta Was this translation helpful? Give feedback.
-
upping on this, as the current implementation seems like it doesn't support this scenario at all |
Beta Was this translation helpful? Give feedback.
-
@septatrix Did you try the dynamic import approach? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe what you want
It is a common requirement that applications should support different dialects.
The most common scenarios where this is relevant are:
There is obviously the disadvantage that dialect specific features cannot be used. For many applications, however, this is fine and additional features/optimizations are not required.
It would be great if Drizzle added the capability to define schemas using a common subset of features supported by all dialects. These could for example be defined in
drizzle-orm/common-core
.Coming from Python, this is similarly supported by SQLAlchemy. In the JS world I have worked with TypeORM which also supports this.
Alternatively, is there any suggested workaround? I think it might be possible to define the schema for all dialect one wants to support and then choose them at runtime with dynamic import though that will most likely upset typescript a lot and have its own complications.
Have I missed anything?
Beta Was this translation helpful? Give feedback.
All reactions