connect-session-sequelize icon indicating copy to clipboard operation
connect-session-sequelize copied to clipboard

Made it possible to use JSON fields for data in the database

Open ilikeintegratedcircuit opened this issue 5 years ago • 3 comments

Changes have been made to implement the ability to use JSON fields to store data in the database. It also solves the problem of converting data when saving and reading, and also preserves the original data types (the number does not become a string)

I made for this: created a model with JSON data field

created option isDataFieldText in SequelizeStoreOptions, for connect model with JSON data field; new model has been connected

created converting and reverse converting session data to string or to JSON

ilikeintegratedcircuit avatar Nov 19 '20 09:11 ilikeintegratedcircuit

Changes have been made to implement the ability to use JSON fields to store data in the database. It also solves the problem of converting data when saving and reading, and also preserves the original data types (the number does not become a string)

ilikeintegratedcircuit avatar Nov 19 '20 09:11 ilikeintegratedcircuit

I tend to disagree with this PR as I don't see the benefit much. JSON fields are not supported in all databases and connect-session-sequelize converts between the two representations without issue. Unless I see more support for this change I'm not gonna merge this.

mweibel avatar Dec 04 '20 08:12 mweibel

Good afternoonI agree, that not all databases support JSON fields, but many do. My version retains the user's choice. Now there is a problem with the numbers obtained. They return as string and this causes errors in strict comparisons (===)   04.12.2020, 11:28, "Michael Weibel" [email protected]: I tend to disagree with this PR as I don't see the benefit much. JSON fields are not supported in all databases and connect-session-sequelize converts between the two representations without issue.Unless I see more support for this change I'm not gonna merge this.—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

ilikeintegratedcircuit avatar Dec 04 '20 13:12 ilikeintegratedcircuit