0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

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_product_events',
'members_newsletters', 'members_newsletters',
'comments', 'comments',
'comment_likes' 'comment_likes',
'comment_reports'
]; ];
// NOTE: exposing only tables which are going to be included in a "default" export file // 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}, id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: 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'}, 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'}, 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} 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', 'brute',
'comments', 'comments',
'comment_likes', 'comment_likes',
'comment_reports',
'custom_theme_settings', 'custom_theme_settings',
'email_batches', 'email_batches',
'email_recipients', 'email_recipients',

View file

@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/ */
describe('DB version integrity', function () { describe('DB version integrity', function () {
// Only these variables should need updating // Only these variables should need updating
const currentSchemaHash = 'f762fe5aeec22dc6c8a204c9a5d3cc39'; const currentSchemaHash = 'ca62bf36d1fdccbbbd951d9f7ecadcd7';
const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f'; const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f';
const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7'; const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';