Added comment_likes table creation migration

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

- new table to handle likes on comments. This is not a join table, so it is comment_likes, rather than comments_likes
This commit is contained in:
Kevin Ansfield 2022-07-05 11:44:51 +02:00 committed by Hannah Wolfe
parent 799a42062c
commit 959786b71f
5 changed files with 19 additions and 2 deletions

View File

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

View File

@ -0,0 +1,8 @@
const {addTable} = require('../../utils');
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}
});

View File

@ -753,5 +753,12 @@ module.exports = {
edited_at: {type: 'dateTime', nullable: true},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: false}
},
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},
updated_at: {type: 'dateTime', nullable: false}
}
};

View File

@ -26,6 +26,7 @@ describe('Exporter', function () {
'api_keys',
'brute',
'comments',
'comment_likes',
'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 = 'b582244f25b7e33b7cdda20427f79702';
const currentSchemaHash = 'f762fe5aeec22dc6c8a204c9a5d3cc39';
const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f';
const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';