mweibel / connect-session-sequelize

Sequelize SessionStore for Express/Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid object name 'Session'.

UziTech opened this issue · comments

seems latest release broke mssql because Session is a reserved word

or because it doesn't use the table name from the already imported model

I fixed it in my code by including the table option

  const db = new Sequelize(...)
	db.import(path.resolve(__dirname, "./models/sessions"))
- const store = new SequelizeStore({db})
+ const store = new SequelizeStore({db, table: "sessions"})

This seems like a breaking change.

Ouch.
Thanks for reporting.
@durek1337 any idea what went wrong here?

@UziTech if you just do this change: UziTech@f78d538 it works again?

Hello, you should simply be able to use the option tableName with "Sessions". But maybe it would be better to use the default modelKey pluralized for tableName as default. That would lead in "Sessions" by default and is the way how sequelize generates tablenames as far as I remember. I will look after it when I'm back from work.

@mweibel yes because my table is called sessions. I probably should have been using the table: "sessions" option anyway but it was working without it before v6.1.0

I'm guessing it worked prior to v6.1.0 because the default model didn't have a tableName property and sequelize pluralized the model name by default like @durek1337 said.

The default tableName option should probably be "Sessions" to keep backwards compatibility

Version 6.1.1 has been released. Thanks @UziTech

Thanks for the quick response 🎉