Skip to content

Commit bb5e021

Browse files
jackycuteSISheogorath
authored andcommitted
Fix field type to prevent data truncation of authorship (#721)
* Fix field type to prevent data truncation of authorship
1 parent dfa0851 commit bb5e021

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
module.exports = {
4+
up: function (queryInterface, Sequelize) {
5+
queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT('long')})
6+
queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT('long')})
7+
},
8+
9+
down: function (queryInterface, Sequelize) {
10+
queryInterface.changeColumn('Notes', 'authorship', {type: Sequelize.TEXT})
11+
queryInterface.changeColumn('Revisions', 'authorship', {type: Sequelize.TEXT})
12+
}
13+
}

lib/models/note.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = function (sequelize, DataTypes) {
6969
}
7070
},
7171
authorship: {
72-
type: DataTypes.TEXT,
72+
type: DataTypes.TEXT('long'),
7373
get: function () {
7474
return sequelize.processData(this.getDataValue('authorship'), [], JSON.parse)
7575
},

lib/models/revision.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = function (sequelize, DataTypes) {
8888
type: DataTypes.INTEGER
8989
},
9090
authorship: {
91-
type: DataTypes.TEXT,
91+
type: DataTypes.TEXT('long'),
9292
get: function () {
9393
return sequelize.processData(this.getDataValue('authorship'), [], JSON.parse)
9494
},

0 commit comments

Comments
 (0)