From 0b92bb2c04445c72cf1599b153f1b75083c674a6 Mon Sep 17 00:00:00 2001 From: les Date: Tue, 12 Nov 2019 14:32:34 +0100 Subject: [PATCH] [fix] comment ap_id key length --- server/api/models/comment.js | 2 +- .../20191112101545-ap_comment_id.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 server/migrations/20191112101545-ap_comment_id.js diff --git a/server/api/models/comment.js b/server/api/models/comment.js index 7b836812..793ab8e0 100644 --- a/server/api/models/comment.js +++ b/server/api/models/comment.js @@ -2,7 +2,7 @@ module.exports = (sequelize, DataTypes) => { const comment = sequelize.define('comment', { activitypub_id: { - type: DataTypes.STRING(18), + type: DataTypes.STRING, index: true, unique: true }, diff --git a/server/migrations/20191112101545-ap_comment_id.js b/server/migrations/20191112101545-ap_comment_id.js new file mode 100644 index 00000000..6a7f2b4d --- /dev/null +++ b/server/migrations/20191112101545-ap_comment_id.js @@ -0,0 +1,19 @@ +'use strict'; + +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.changeColumn('comments', 'activitypub_id', { + type: Sequelize.STRING, + index: true, + unique: true + }) + }, + + down: (queryInterface, Sequelize) => { + return queryInterface.changeColumn('comments', 'activitypub_id', { + type: Sequelize.STRING(18), + index: true, + unique: true + }) + } +}