Added comment_reports table creation migration

refs https://github.com/TryGhost/Team/issues/1664

- new table to handle moderation reports on comments. This is not a join table, so it is comment_reports, rather than comments_reports
This commit is contained in:
Kevin Ansfield 2022-07-05 11:55:43 +02:00 committed by Hannah Wolfe
parent 959786b71f
commit a78eed1799
6 changed files with 24 additions and 3 deletions

View File

@ -33,7 +33,8 @@ const BACKUP_TABLES = [
'members_product_events',
'members_newsletters',
'comments',
'comment_likes'
'comment_likes',
'comment_reports'
];
// NOTE: exposing only tables which are going to be included in a "default" export file

View File

@ -4,5 +4,6 @@ module.exports = addTable('comment_likes', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: true},
member_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'members.id'},
created_at: {type: 'dateTime', nullable: false}
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: false}
});

View File

@ -0,0 +1,10 @@
const {addTable} = require('../../utils');
module.exports = addTable('comment_reports', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: true},
member_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'members.id'},
reason: {type: 'text', maxlength: 65535, nullable: false},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: false}
});

View File

@ -760,5 +760,13 @@ module.exports = {
member_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'members.id'},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: false}
},
comment_reports: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: true},
member_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'members.id'},
reason: {type: 'text', maxlength: 65535, nullable: false},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: false}
}
};

View File

@ -27,6 +27,7 @@ describe('Exporter', function () {
'brute',
'comments',
'comment_likes',
'comment_reports',
'custom_theme_settings',
'email_batches',
'email_recipients',

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 = 'f762fe5aeec22dc6c8a204c9a5d3cc39';
const currentSchemaHash = 'ca62bf36d1fdccbbbd951d9f7ecadcd7';
const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f';
const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';