diff --git a/core/server/data/exporter/table-lists.js b/core/server/data/exporter/table-lists.js index 13b78751bb..763dbc1a38 100644 --- a/core/server/data/exporter/table-lists.js +++ b/core/server/data/exporter/table-lists.js @@ -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 diff --git a/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js b/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js index 318c134aa5..ba422e2eff 100644 --- a/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js +++ b/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js @@ -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} }); diff --git a/core/server/data/migrations/versions/5.3/2022-07-05-09-47-add-comments-reports-table.js b/core/server/data/migrations/versions/5.3/2022-07-05-09-47-add-comments-reports-table.js new file mode 100644 index 0000000000..86c5d5a90c --- /dev/null +++ b/core/server/data/migrations/versions/5.3/2022-07-05-09-47-add-comments-reports-table.js @@ -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} +}); diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index 8481fce750..7f42fe3bd1 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -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} } }; diff --git a/test/integration/exporter/exporter.test.js b/test/integration/exporter/exporter.test.js index 9d3e81b13e..eb8509a1cd 100644 --- a/test/integration/exporter/exporter.test.js +++ b/test/integration/exporter/exporter.test.js @@ -27,6 +27,7 @@ describe('Exporter', function () { 'brute', 'comments', 'comment_likes', + 'comment_reports', 'custom_theme_settings', 'email_batches', 'email_recipients', diff --git a/test/unit/server/data/schema/integrity.test.js b/test/unit/server/data/schema/integrity.test.js index e0f7f428a4..6bba89394c 100644 --- a/test/unit/server/data/schema/integrity.test.js +++ b/test/unit/server/data/schema/integrity.test.js @@ -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';