summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Wu2018-02-09 21:27:06 +0800
committerChristoph (Sheogorath) Kern2018-02-09 14:27:06 +0100
commitbb5e021f201c8ad83fe2736dee0faef123bfca50 (patch)
treef4573f2b4c00fe5a205e161aa128e6594923a952
parentdfa0851d8fda25e1af80e77c318037fac9e342f6 (diff)
Fix field type to prevent data truncation of authorship (#721)
* Fix field type to prevent data truncation of authorship
Diffstat (limited to '')
-rw-r--r--lib/migrations/20180209120907-longtext-of-authorship.js13
-rw-r--r--lib/models/note.js2
-rw-r--r--lib/models/revision.js2
3 files changed, 15 insertions, 2 deletions
diff --git a/lib/migrations/20180209120907-longtext-of-authorship.js b/lib/migrations/20180209120907-longtext-of-authorship.js
new file mode 100644
index 00000000..4cca5444
--- /dev/null
+++ b/lib/migrations/20180209120907-longtext-of-authorship.js
@@ -0,0 +1,13 @@
+'use strict'
+
+module.exports = {
+ up: function (queryInterface, Sequelize) {
+ queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT('long')})
+ queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT('long')})
+ },
+
+ down: function (queryInterface, Sequelize) {
+ queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT})
+ queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT})
+ }
+}
diff --git a/lib/models/note.js b/lib/models/note.js
index 33dde80d..484f1a8c 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -69,7 +69,7 @@ module.exports = function (sequelize, DataTypes) {
}
},
authorship: {
- type: DataTypes.TEXT,
+ type: DataTypes.TEXT('long'),
get: function () {
return sequelize.processData(this.getDataValue('authorship'), [], JSON.parse)
},
diff --git a/lib/models/revision.js b/lib/models/revision.js
index 170931b8..9ecd14dc 100644
--- a/lib/models/revision.js
+++ b/lib/models/revision.js
@@ -88,7 +88,7 @@ module.exports = function (sequelize, DataTypes) {
type: DataTypes.INTEGER
},
authorship: {
- type: DataTypes.TEXT,
+ type: DataTypes.TEXT('long'),
get: function () {
return sequelize.processData(this.getDataValue('authorship'), [], JSON.parse)
},