Skip to content

With timestamps enabled in sequelize library failing to get session #11

Description

@unsigned6

I have a project with sequelize and enabled timestamps by default.
This means that for all models I have fields createdAt and updatedAt.
Also, these fields are automatically added to each generated by sequelize SQL query.

Because of this get session method SequelizeSessionStore.get which uses Session.findByPk is generating next query:

 Executing (default): SELECT `session_id`, `expires`, `data`, `createdAt`, `updatedAt` FROM `Sessions` AS `Session` WHERE `Session`.`session_id` = 'pprihgrAbXvDftF6y5IL6OEDYiXe8z_l';

To ommit that easily can be added { timestamps: false } to Sessions definition.

Previously I was using express-mysql-session, but it create an issue with running tests with an hanging db connection after test run. So decided to switch to your package to reuse the same connection which sequelize provides. And currently can not use this library, cuz already there sessions table without timestamps fields.

Activity

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions