Fix #521 by converting content fields to LONGTEXT in MySQL, to prevent truncation of data.
This commit is contained in:
parent
5ce8f40eac
commit
cc49ce55c8
3 changed files with 20 additions and 4 deletions
16
lib/migrations/20171009121200-longtext-for-mysql.js
Normal file
16
lib/migrations/20171009121200-longtext-for-mysql.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
'use strict'
|
||||||
|
module.exports = {
|
||||||
|
up: function (queryInterface, Sequelize) {
|
||||||
|
queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT('long')})
|
||||||
|
queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT('long')})
|
||||||
|
queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT('long')})
|
||||||
|
queryInterface.changeColumn('Revisions', 'latContent', {type: Sequelize.TEXT('long')})
|
||||||
|
},
|
||||||
|
|
||||||
|
down: function (queryInterface, Sequelize) {
|
||||||
|
queryInterface.changeColumn('Notes', 'content', {type: Sequelize.TEXT})
|
||||||
|
queryInterface.changeColumn('Revisions', 'patch', {type: Sequelize.TEXT})
|
||||||
|
queryInterface.changeColumn('Revisions', 'content', {type: Sequelize.TEXT})
|
||||||
|
queryInterface.changeColumn('Revisions', 'latContent', {type: Sequelize.TEXT})
|
||||||
|
}
|
||||||
|
}
|
|
@ -60,7 +60,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT('long'),
|
||||||
get: function () {
|
get: function () {
|
||||||
return sequelize.processData(this.getDataValue('content'), '')
|
return sequelize.processData(this.getDataValue('content'), '')
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
defaultValue: Sequelize.UUIDV4
|
defaultValue: Sequelize.UUIDV4
|
||||||
},
|
},
|
||||||
patch: {
|
patch: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT('long'),
|
||||||
get: function () {
|
get: function () {
|
||||||
return sequelize.processData(this.getDataValue('patch'), '')
|
return sequelize.processData(this.getDataValue('patch'), '')
|
||||||
},
|
},
|
||||||
|
@ -67,7 +67,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lastContent: {
|
lastContent: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT('long'),
|
||||||
get: function () {
|
get: function () {
|
||||||
return sequelize.processData(this.getDataValue('lastContent'), '')
|
return sequelize.processData(this.getDataValue('lastContent'), '')
|
||||||
},
|
},
|
||||||
|
@ -76,7 +76,7 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
type: DataTypes.TEXT,
|
type: DataTypes.TEXT('long'),
|
||||||
get: function () {
|
get: function () {
|
||||||
return sequelize.processData(this.getDataValue('content'), '')
|
return sequelize.processData(this.getDataValue('content'), '')
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue