Skip to content

Commit af082d9

Browse files
authored
Merge pull request #567 from ccoenen/fix-mysql-text-length
converting all content fields to MEDIUMTEXT (affects MySQL only)
2 parents 9219a9b + cc49ce5 commit af082d9

File tree

3 files changed

+20
-4
lines changed

3 files changed

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

lib/models/note.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = function (sequelize, DataTypes) {
6060
}
6161
},
6262
content: {
63-
type: DataTypes.TEXT,
63+
type: DataTypes.TEXT('long'),
6464
get: function () {
6565
return sequelize.processData(this.getDataValue('content'), '')
6666
},

lib/models/revision.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = function (sequelize, DataTypes) {
5858
defaultValue: Sequelize.UUIDV4
5959
},
6060
patch: {
61-
type: DataTypes.TEXT,
61+
type: DataTypes.TEXT('long'),
6262
get: function () {
6363
return sequelize.processData(this.getDataValue('patch'), '')
6464
},
@@ -67,7 +67,7 @@ module.exports = function (sequelize, DataTypes) {
6767
}
6868
},
6969
lastContent: {
70-
type: DataTypes.TEXT,
70+
type: DataTypes.TEXT('long'),
7171
get: function () {
7272
return sequelize.processData(this.getDataValue('lastContent'), '')
7373
},
@@ -76,7 +76,7 @@ module.exports = function (sequelize, DataTypes) {
7676
}
7777
},
7878
content: {
79-
type: DataTypes.TEXT,
79+
type: DataTypes.TEXT('long'),
8080
get: function () {
8181
return sequelize.processData(this.getDataValue('content'), '')
8282
},

0 commit comments

Comments
 (0)