Skip to content

4.0 #5898

Closed
Closed

Description

@felixfbecker

I wanted to push the discussion around 4.0 a little bit, summarize what is left to decide so 4.0 can be developed / released, and make a proposal:

  • Support only Node >4 Only support Node v4.0.0 and up #5205. Benefits: native classes, native Promises, arrow functions. Implies Travis: test Node 4, 5, 6? #5878
  • ES6 in Sequelize codebase ES6 in Sequelize codebase #3951 (without Babel, classes, arrow functions)
  • Make instances instanceof Model (with native classes) Make Instances instances of Model #5877
    • Better OOP semantics
    • define() still works as Model factory
    • users can extend Sequelize.Model
      • awesome for type-safety / autocompletion
      • alternative to classMethods / instanceMethods / getterMethods / setterMethods
    • Model.init() static initializer attaches attribute metadata to the model
      • third-party module can define class/attribute decorators that does this for users of TypeScript / Babel - decorators are the perfect semantic for defining additional metadata for Sequelize on the attributes
    • Need some way to register a model to a Sequelize instance / model manager, sequelize.add(Model)?

Other than that, keep the API / concept changes small. Let users still use define() like they are used to, but enable users of TS / Babel to explore new ways of defining models.

Activity

  1. added this to the 4.0 milestone on May 16, 2016
  2. janmeier commented on May 17, 2016

    @janmeier
    Member

    FYI - I've moved 3.0 to a separate branch (https://github.com/sequelize/sequelize/tree/v3), and made master 4.0.0-1. I've also started merging some PRs with minor BC breaks (see changelog) so we can hopefully get the 4.0 ball rolling.

    The idea as that all new development is aimed at 4.0, but if people badly need a feature / bugfix in 3.0 they are welcome to create a backport PR. But we in the core team (Mick and I) at least will only work on 4.0.

    I know some people will probably be annoyed by us "cutting" support for 3.0, but we simply don't have the resources to maintain two separate branches. We tried that with the 2.0 -> 3.0 transition and hated it :(.

    With regards to node version I'm leaning mostly towards 6 only, or perhaps 6 + 0.12 with babel. I'd really like to use coroutines and generators, but that would force 0.12 users to use --harmony. But I think the increased readability of the code would make up for it.

    We have been saving up quite a lot of issues with BC breaks that we want to land in 4.0 https://github.com/sequelize/sequelize/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3Asemver%3Amajor+

  3. mickhansen commented on May 24, 2016

    @mickhansen
    Contributor

    We should consider 6.0 only, but we'll need to consider what benefits we'll receive compared to not supported an active LTS version.

    I don't believe we should use Babel since it removes the option of npm installed from tag/branch/commit.
    We are considering coroutines since the performance impact seems to be minor if any.

  4. overlookmotel commented on May 24, 2016

    @overlookmotel
    Contributor

    Just to note here (so it's noted somewhere) that bluebird.coroutine() will likely need to be shimmed to maintain CLS context.

    In my own code, in order to combine coroutines and CLS, I'm using co-bluebird and then setting it to use Sequelize.Promise like so:

    var co = require('co-bluebird').use(Sequelize.Promise);

    I've encountered one weird edge case where CLS context occasionally gets lost which I'm trying to resolve, but that apart, it's solid.

    bluebird-co also looks promising, but I don't know whether it supports CLS.

    Vanilla bluebird.coroutine() doesn't give you all the sweet sugar that co does e.g. yield [ promise1, promise2 ] being the same as yield Promise.all( [ promise1, promise2 ] )

  5. overlookmotel commented on May 24, 2016

    @overlookmotel
    Contributor

    Destructuring assignments (var [a, b] = [1, 2];) only arrived in node v6 :(

    Table of ES6 support in different node versions here: http://node.green/

  6. janmeier commented on May 24, 2016

    @janmeier
    Member

    Descructuring assigment with default values would have been nice - But I agree that it should be possible to install directly from git, so we'll need to stick to 4.0 features.

    I just started rewriting some of the code in model.js to use coroutines, and so far CLS tests still pass (i've changed findAll and a couple others).

    Regarding yield sugar, I've added a yield handler that handles the array case - Haven't needed other forms of sugar yet :)

  7. mickhansen commented on May 24, 2016

    @mickhansen
    Contributor

    Well atleast we get object literal extensions and template literals.

  8. sushantdhiman commented on May 24, 2016

    @sushantdhiman
    Contributor

    install directly from git

    Yes, thats something I am interested in. At least we will get some of ES6 feature from v4.0

    Other thing I would like us to work on is improving performance. There are lots of issues already https://github.com/sequelize/sequelize/search?q=performance&state=open&type=Issues&utf8=✓

    I don't know how we should tackle it but I think we should stick to minimal feature set rather than adding lots of feature to make our codebase more complex and slow. We can convert some modules to plugins and move them away from sequelize-core

  9. mickhansen commented on May 24, 2016

    @mickhansen
    Contributor

    For performance we first need a seperate benchmark repo that we can run against version of Sequelize (with npm link or whatever).

    Over time we should move as much as possible away from core. And i'm also working on making most of the codebase batchable which should enable separate: true and other stuff.

  10. sushantdhiman commented on May 24, 2016

    @sushantdhiman
    Contributor

    I'll work on https://github.com/sequelize/sequelize-performance to introduce better benchmarks. After that may be we can hook it with the Travis to see per pull request based performance changes.

    I am looking for completion of separate:true as well. I plan to make hooks and dialect pluggable to achieve closer to native performance. But that will be lots of work I guess.

  11. felixfbecker commented on May 24, 2016

    @felixfbecker
    ContributorAuthor

    Dumb question: what is CLS needed for?

  12. mickhansen commented on May 25, 2016

    @mickhansen
    Contributor

    @felixfbecker context maintenance across calls, if passing through options is impractical. It's the same technique used for almost all instrumentation.

  13. mickhansen commented on May 25, 2016

    @mickhansen
    Contributor

    @sushantdhiman Might be worth it to make a completely new repository, that repo deals with benchmarking us vs others, i'd love to just benchmark our own changes.

  14. sushantdhiman commented on May 25, 2016

    @sushantdhiman
    Contributor

    Ok I'll create one. I will benchmark against native db drivers on various node version (4 and 6).

  15. mickhansen commented on May 25, 2016

    @mickhansen
    Contributor

    @sushantdhiman Just create one benchmark where the node version, sequelize version, dialect is easily swappable in the environment.

    nvm use 6|4
    # sequelize
    git checkout perf-improvments
    npm link
    # sequelize-benchmark
    npm link sequelize
    npm run start-(postgres|mysql)
    

    This doesn't need to be run on CI atm, we just need to be able to run it ourselves where it produces a nice copy pasteable format so we can manually diff here on git.

    I'd love something lower level than the entire travis setup we have here atm :)

  16. 25 remaining items

  17. added
    status: in discussion
    on Jun 21, 2016
  18. felixfbecker commented on Aug 28, 2016

    @felixfbecker
    ContributorAuthor
  19. broofa commented on Jan 13, 2017

    @broofa
    Contributor

    Is there a timeline for when 4.0.0 will drop? I see the "4.0.0-x" versions in npm info, but I assume that means this work is still experimental.

  20. janmeier commented on Jan 18, 2017

    @janmeier
    Member

    @broofa - Hopefully very soon - We (I) still need to figure out a good solution for hosting of v4 docs, #6886. As far stability I think you should be able to use the pre-release without problems

  21. ralusek commented on Apr 10, 2017

    @ralusek

    @janmeier any update on when this is expected to release?

  22. janmeier commented on Apr 12, 2017

    @janmeier
    Member

    @ralusek Hopefully soon :) - It's getting closer at least. Docs are done now, but we'd still like to address a couple of things related to where conditions

  23. iamjochem commented on Apr 24, 2017

    @iamjochem
    Contributor

    hi Guys,

    I am using Sequelize v4 and have been trying to write as little PR related to ValidationErrorItem functionality ... I have problems getting with the test suite (clean master branch) to run successfully under Node v6.2 ... it dies on a certain test with the following output:

    N.B. I'm only testing with/for MySQL for now

      [MYSQL] BelongsToMany
        getAssociations
          ✓ supports transactions (206ms)
          1) "before each" hook for "gets all associated objects with all fields"
          2) "after each" hook for "gets all associated objects with all fields"
    
    
      5 passing (910ms)
      2 failing
    
      1)  "before each" hook for "gets all associated objects with all fields":
         SequelizeConnectionError: Connection lost: The server closed the connection.
          at Utils.Promise.then.then.catch (lib/dialects/mysql/connection-manager.js:156:21)
      From previous event:
          at ConnectionManager.connect (lib/dialects/mysql/connection-manager.js:142:13)
          at sequelize.runHooks.then (lib/dialects/abstract/connection-manager.js:303:50)
      From previous event:
          at ConnectionManager._connect (lib/dialects/abstract/connection-manager.js:303:8)
          at Promise (lib/dialects/abstract/connection-manager.js:89:14)
      From previous event:
          at Object.pool.Pooling.createPool.create [as create] (lib/dialects/abstract/connection-manager.js:87:23)
          at Pool._createResource (node_modules/generic-pool/lib/Pool.js:279:42)
          at Pool._dispense (node_modules/generic-pool/lib/Pool.js:210:12)
          at Pool.acquire (node_modules/generic-pool/lib/Pool.js:406:10)
          at Promise (lib/dialects/abstract/connection-manager.js:270:45)
      From previous event:
          at promise.then (lib/dialects/abstract/connection-manager.js:269:7)
      From previous event:
          at ConnectionManager.getConnection (lib/dialects/abstract/connection-manager.js:268:20)
          at Promise.try (lib/sequelize.js:521:92)
      From previous event:
          at Sequelize.query (lib/sequelize.js:428:23)
          at Promise.map.tableName (lib/query-interface.js:447:22)
      From previous event:
          at QueryInterface.getForeignKeysForTables (lib/query-interface.js:446:20)
          at showAllTables.then.tableNames (lib/query-interface.js:234:21)
      From previous event:
          at QueryInterface.dropAllTables (lib/query-interface.js:220:40)
          at Object.clearDatabase (test/support.js:131:8)
          at Context.<anonymous> (test/integration/support.js:18:18)
    
      2)  "after each" hook for "gets all associated objects with all fields":
         Error: Expected 0 running queries. 3 queries still running in [MYSQL] BelongsToMany getAssociations gets all associated objects with all fields
          at Object.verifyNoRunningQueries (lib/sequelize.js:242:45)
          at Context.<anonymous> (test/integration/support.js:23:25)

    I have also tried to run the [mysql] tests (again with clean master branch) on Node v4.2.1 and that also dies (in the "[MYSQL] Transaction" tests) with the following output (up to that point a handful of tests have already failed, which suprises me because it's a clean master branch):

    An unhandled exception occured:
    /work/oo/forks/sequelize/test/support.js:23
      throw e;
      ^
    
    Error: connect ETIMEDOUT
        at Connection._handleTimeoutError (/work/oo/forks/sequelize/node_modules/mysql2/lib/connection.js:179:13)
        at null.<anonymous> (/work/oo/forks/sequelize/node_modules/async-listener/glue.js:188:31)
        at Timer.listOnTimeout (timers.js:92:15)

    Questions regarding Node versions:

    1. Is Node v6+ official supported? my experience is that it works great but I'm definitely not using alot of functionality (e.g. "BelongsTo.." functionality).
    2. Is the master branch currently unstable? is it known that some tests are breaking? (or am I suffering from some local mess)
  24. felixfbecker commented on Apr 24, 2017

    @felixfbecker
    ContributorAuthor

    @iamjochem see Travis: https://travis-ci.org/sequelize/sequelize. Your test failures seem to be a problem with your DB server, not sequelize.

  25. iamjochem commented on Apr 24, 2017

    @iamjochem
    Contributor

    @felixfbecker - okay then, tests themselves seem to be fine. My DB server is not the problem either ... it's on localhost (same place i'm running the tests), it is running fine and other processes/apps are using it).

    I do notice that there are a stack of ENV vars that I can set (e.g. MYSQL_VER) which I'm not currently doing ... I'll have a play with those.

    Anyway it looks like I broke something locally ... if I manage to determine anything I think might be useful generally I'll report back here.

    ... thanks for reading & helping!

  26. felixfbecker commented on Apr 24, 2017

    @felixfbecker
    ContributorAuthor

    It's more suited for our Slack channel than for this issue tbh

  27. iamjochem commented on Apr 24, 2017

    @iamjochem
    Contributor

    probably ... but seeing as it's invite only ;-) (any chance of an invite?)

  28. sushantdhiman commented on Jun 8, 2017

    @sushantdhiman
    Contributor
  29. removed
    status: in discussion
    on Oct 28, 2019
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions