diff --git a/ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js b/ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js index a9e174299f..0f5d33aa5a 100644 --- a/ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js +++ b/ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js @@ -5,5 +5,8 @@ module.exports = addTable('email_spam_complaint_events', { member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true}, email_id: {type: 'string', maxlength: 24, nullable: false, references: 'emails.id'}, email_address: {type: 'string', maxlength: 191, nullable: false, unique: false}, - created_at: {type: 'dateTime', nullable: false} + created_at: {type: 'dateTime', nullable: false}, + '@@UNIQUE_CONSTRAINTS@@': [ + ['email_id', 'member_id'] + ] }); diff --git a/ghost/core/core/server/data/schema/schema.js b/ghost/core/core/server/data/schema/schema.js index 8ed48a1d1c..30f32a090a 100644 --- a/ghost/core/core/server/data/schema/schema.js +++ b/ghost/core/core/server/data/schema/schema.js @@ -972,6 +972,9 @@ module.exports = { member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true}, email_id: {type: 'string', maxlength: 24, nullable: false, references: 'emails.id'}, email_address: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}}, - created_at: {type: 'dateTime', nullable: false} + created_at: {type: 'dateTime', nullable: false}, + '@@UNIQUE_CONSTRAINTS@@': [ + ['email_id', 'member_id'] + ] } }; diff --git a/ghost/core/test/unit/server/data/schema/integrity.test.js b/ghost/core/test/unit/server/data/schema/integrity.test.js index 7d6412f43d..6e785d16b9 100644 --- a/ghost/core/test/unit/server/data/schema/integrity.test.js +++ b/ghost/core/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 = '7376b855d023c40d1c0ff5770d1d01fd'; + const currentSchemaHash = 'aa2f277e624b5fbe5f18cb0d78ff18f4'; const currentFixturesHash = 'dcb7ba7c66b4b98d6c26a722985e756a'; const currentSettingsHash = '9acce72858e75420b831297718595bbd'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';