Switch type of Metadata value column

Summary:
Found a funny send-later bug I didn't catch when testing on staging: sometimes the data we're saving in the metadata table overflows. That's because MySQL's TEXT column are at most 64k, which is easy to reach when you have a draft + clearbit information and additional stuff.

To work around this, I decided to switch the database type of the metadata table to LONGTEXT. Since it can store 4Gb of text, we should be good. This diff makes those code changes. Obviously, we'll have to run migrations both on staging and prod.

Test Plan: Ran a basic smoke test. Shouldn't break anything.

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4250
This commit is contained in:
Karim Hamidou 2017-03-22 11:19:10 -07:00
parent 1f9c5120cd
commit 3e3b0b84f1

View file

@ -3,7 +3,7 @@ const Sequelize = require('sequelize');
module.exports = {
JSONColumn(fieldName, options = {}) {
return Object.assign(options, {
type: Sequelize.TEXT,
type: options.columnType || Sequelize.TEXT,
get() {
const val = this.getDataValue(fieldName);
if (!val) {