Skip to content

Commit

Permalink
Add support for the JSON MySQL type
Browse files Browse the repository at this point in the history
MySQL supports the JSON type since 5.7.8 which is a nice way to store and work with nested documents.
  • Loading branch information
dangoodman authored Aug 31, 2018
1 parent 91e5a94 commit 8a878cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ const NATIVE_TYPES = {
val = val.replace(controlRegex, '')
return val
}
},
'JSON': {
type: 'JSON',
convert: val => {
return sqlstring.escape(JSON.stringify(val));
}
}
}

Expand Down

0 comments on commit 8a878cd

Please sign in to comment.