Skip to content

Extract dialects into own modules #6285

Closed

Description

@felixfbecker

Currently, users have to manually install the driver they want to use. However, there is no version constraint on what version of these drivers work with sequelize. Any major release could break sequelize.

Nevertheless, when running npm install sequelize, users get a whole lot of code for dialects they will not use. A much better solution would be if every subfolder of the dialects folder was a seperate module, like sequelize-dialect-postgres. User would then install this, and it would have a dependency on the needed driver version and a peer dependency on sequelize. That way NPM will not allow users to have an old dialect version with a newer, incompatible sequelize version.

The unit tests for the specific dialects would also be moved and run in a seperate CI, which would reduce build time. The integration tests will probably still be run in the main sequelize repo for all dialects.

What do you think?

Activity

  1. mickhansen commented on Jul 16, 2016

    @mickhansen
    Contributor

    The unit tests for the specific dialects would also be moved and run in a seperate CI

    Keeping tests in sync would be a major issue - If you're considering moving SQL generation aswell.
    And if we did have unit tests centralized then it becomes a major issue to make sure the dialect is working.

  2. felixfbecker commented on Jul 16, 2016

    @felixfbecker
    ContributorAuthor

    Keeping tests in sync would be a major issue - If you're considering moving SQL generation aswell.

    What I meant was that the dialect specific tests would be moved to the different repos too. I don't understand how that would be an issue?

    And if we did have unit tests centralized then it becomes a major issue to make sure the dialect is working.

    sequelize would have a devDependency on each of the dialects for testing.

  3. mickhansen commented on Jul 16, 2016

    @mickhansen
    Contributor

    @felixfbecker Ah, yeah, that would not be a problem. Thought you meant everything dialect specific, which would be sql unit tests aswell :)

  4. mickhansen commented on Jul 16, 2016

    @mickhansen
    Contributor

    But there's still an issue with fixing issues that stem from the dialect connector/query generator. It's not ideal having the code and test be in two different repos, you'll need to link while developing (doesn't work in docker containers) and you'll need to publish and bump for each fix.

    I definitely want to split it out aswell, but i don't see a fix for testing that won't be totally annoying.

  5. felixfbecker commented on Jul 16, 2016

    @felixfbecker
    ContributorAuthor

    Yes, you are right. To assure that a change to a dialect didn't break anything, the whole test suite including integration tests would have to be run. Which is located in the main repo. The only option would be to truly move every single test that is needed for the dialect aswell.

    One option could be to put the complete test suite in a repo sequelize-tests that the main repo and every dialect has a devDependency on. We could link this directly from GitHub, then we don't need to version it with a package.json and publish on NPM. There could be seperate branches for major versions.

  6. sushantdhiman commented on Jul 16, 2016

    @sushantdhiman
    Contributor

    Managing version dependency between all dialects-repo, core-repo and test-repo will be really hard to maintain and reason about

  7. felixfbecker commented on Aug 19, 2016

    @felixfbecker
    ContributorAuthor

    I guess we decided against this

  8. added
    status: in discussion
    on Aug 19, 2016
  9. mattbrunetti commented on Apr 18, 2017

    @mattbrunetti

    @felixfbecker @mickhansen @sushantdhiman Are you guys familiar with lerna? It's a tool for managing multiple packages in a single repo (a "monorepo"), so all of the source code and tests are versioned together, but you can publish them separately to NPM.

    Some other big projects mentioned in the link below manage to have monorepos without the tool, but the idea is the same.

    https://github.com/lerna/lerna#about

  10. felixfbecker commented on Apr 19, 2017

    @felixfbecker
    ContributorAuthor

    Yes, I am. Death to monorepos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: in discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions