diff options
author | Yukai Huang | 2017-01-02 15:09:19 +0800 |
---|---|---|
committer | Yukai Huang | 2017-01-02 15:09:19 +0800 |
commit | 65acaea8cf47629c7e5710e444973a04526b047d (patch) | |
tree | f09efeaab513ffd7fb58d2af17a1ea1070a02251 /lib/models/index.js | |
parent | 1e276fb37a4ed8e19234de7192d8593314f53799 (diff) | |
parent | ac2b100d35bd9dd9bcbca8e622a5e7ed48222598 (diff) |
Merge branch 'master' into frontend-next
Diffstat (limited to '')
-rw-r--r-- | lib/models/index.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/models/index.js b/lib/models/index.js index de6cd13c..e83956e5 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -20,6 +20,19 @@ if (config.dburl) else sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig); +// [Postgres] Handling NULL bytes +// https://github.com/sequelize/sequelize/issues/6485 +function stripNullByte(value) { + return value ? value.replace(/\u0000/g, "") : value; +} +sequelize.stripNullByte = stripNullByte; + +function processData(data, _default, process) { + if (data === undefined) return data; + else return data === null ? _default : (process ? process(data) : data); +} +sequelize.processData = processData; + var db = {}; fs |