New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract dialects out of the core #13722
Comments
We're finally working on this The high level plan is to have individual packages for each dialect, such as Each package will provide all the dialect-specific code. This means that it will be much easier for the community to create third-party dialect packages, even though they would currently still need to use many unstable internal APIs. This second part is something we'll improve in the future by providing a clean public dialect API, such as Each package will also include the relevant connector library (pg, mariadb, tedious, etc). Users won't have to figure out which version should be installed anymore. Finally, the dialect-specific options will be better checked in both typing and runtime checks When initializing Sequelize, users will now need to provide the dialect package instead of a dialect name. Here is what it would look like: import { PostgresDialect } from '@sequelize/postgres';
new Sequelize({
dialect: PostgresDialect,
// dialect-specific options
username: 'demo',
password: 'demo',
native: true,
// sequelize options
pool: { max: 5 },
}); In this version, all options are provided to Sequelize itself. Sequelize then picks the ones that are dialect specific and gives them to the dialect instance when initializing it. The The dialect would expose a static method called
Because credentials are dialect-specific, we need to change the signature of the constructor to only accept an option bag. The old |
I believe this is a great direction to take this. Will this apply to v6 or is this a v7 initiative? |
This is a v7 initiative, and will also continue on in v8 most likely |
v7 I think* has been worked for the last two years if I'm not mistaken. Do we think v7 will reach a stable release in the foreseeable future? |
We've discussed the release of v7 today with our core team. The v7 alphas are already quite stable. After the initial extraction of dialects we want to move into a beta phase for v7 while we work on updating CLI and help bigger third-party packages migrate to v7. During that beta phase we will be more careful about breaking changes that we add. Doing this work on v6 is counterproductive and requires a lot more work for us. |
@WikiRik for the task about updating the documentation, note that we now have this project to keep track of which PRs still need to be documented: https://github.com/orgs/sequelize/projects/5 |
If we're going to add support for better-sqlite3, maybe we should rename the |
Bit more verbose, but I was also thinking about |
The problem with
If we start proposing multiple adapters, they should make an informed decision on which one they want to use. Otherwise, we'd just pick the one we consider to be the best. Naming one |
You've got a point there. Do we want to do this for the other dialects as well or is this only for sqlite since there is a relatively big demand to support better-sqlite? |
To be consistent, we probably should. Considering the demand has only ever been for sqlite, that may not be worth the trouble. |
Following the changes done in #17222, it will be very important to have a clear page that explains how to configure the credentials per dialect. Right now it's in the "dialect specific things" page, which is a bit too buried for my liking. The "how to connect to your database" chapter should probably go at the very start of the documentation, right after "getting started" and before "defining models". I think it would make sense to have one page per dialect that first gives the basics of connecting to that database type, and has sub-chapters for other dialect-specific options The other dialect-specific things on that page should probably be moved to where they can be used too, so that page could be deleted |
Considering DB2 is really DB2 for Linux, Unix, Windows, and ibmi is really DB2 for IBM i, should we rename the packages to Following discussion with @WikiRik, based on IBM's branding, they should be |
In order to support additional dialects more easily in the future, we want to pull the dialect specific files out of the core and move them into dedicated npm modules.
Relates to sequelize/meetings#2
Current Progress
@sequelize/mariadb
package #17198@sequelize/mssql
package #17206@sequelize/mysql
package #17202@sequelize/postgres
package #17190@sequelize/sqlite
package #17205@sequelize/snowflake
package #17207@sequelize/ibmi
package #17209@sequelize/db2
package #17197url
option based on the dialect #17252@sequelize/sqlite
to@sequelize/sqlite3
,@sequelize/ibmi
to@sequelize/db2-ibmi
, ban conflicting options #17269The text was updated successfully, but these errors were encountered: