Added mentions database table (#16150)

closes https://github.com/TryGhost/Team/issues/2417

- added new `mentions` database table to be able to store incoming webmentions.
- updated schema and tests to match.
This commit is contained in:
Ronald Langeveld 2023-01-20 19:08:07 +08:00 committed by GitHub
parent 8c9893e568
commit 3061fb2b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 1 deletions

View File

@ -37,6 +37,7 @@ const BACKUP_TABLES = [
'members_created_events',
'members_subscription_created_events',
'members_newsletters',
'mentions',
'comments',
'comment_likes',
'comment_reports',

View File

@ -0,0 +1,17 @@
const {addTable} = require('../../utils');
module.exports = addTable('mentions', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
source: {type: 'string', maxlength: 2000, nullable: false},
source_title: {type: 'string', maxlength: 2000, nullable: true},
source_site_title: {type: 'string', maxlength: 2000, nullable: true},
source_excerpt: {type: 'string', maxlength: 2000, nullable: true},
source_author: {type: 'string', maxlength: 2000, nullable: true},
source_featured_image: {type: 'string', maxlength: 2000, nullable: true},
source_favicon: {type: 'string', maxlength: 2000, nullable: true},
target: {type: 'string', maxlength: 2000, nullable: false},
resource_id: {type: 'string', maxlength: 24, nullable: true},
resource_type: {type: 'string', maxlength: 50, nullable: true},
created_at: {type: 'dateTime', nullable: false},
payload: {type: 'text', maxlength: 65535, nullable: true}
});

View File

@ -979,5 +979,20 @@ module.exports = {
'@@UNIQUE_CONSTRAINTS@@': [
['email_id', 'member_id']
]
},
mentions: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
source: {type: 'string', maxlength: 2000, nullable: false},
source_title: {type: 'string', maxlength: 2000, nullable: true},
source_site_title: {type: 'string', maxlength: 2000, nullable: true},
source_excerpt: {type: 'string', maxlength: 2000, nullable: true},
source_author: {type: 'string', maxlength: 2000, nullable: true},
source_featured_image: {type: 'string', maxlength: 2000, nullable: true},
source_favicon: {type: 'string', maxlength: 2000, nullable: true},
target: {type: 'string', maxlength: 2000, nullable: false},
resource_id: {type: 'string', maxlength: 24, nullable: true},
resource_type: {type: 'string', maxlength: 50, nullable: true},
created_at: {type: 'dateTime', nullable: false},
payload: {type: 'text', maxlength: 65535, nullable: true}
}
};

View File

@ -57,6 +57,7 @@ describe('Exporter', function () {
'members_subscribe_events',
'members_created_events',
'members_subscription_created_events',
'mentions',
'migrations',
'migrations_lock',
'mobiledoc_revisions',

View File

@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'a3df9e11b3db1c8afdfb87c7a206b53b';
const currentSchemaHash = '8eab51dd80562c92215283df89b0200b';
const currentFixturesHash = 'f0ccdb0c7eccbc3311e38b5d145ed1db';
const currentSettingsHash = '9acce72858e75420b831297718595bbd';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';