Updated members_email_change_events to store previous email (#12641)

refs https://github.com/TryGhost/Ghost/issues/12602

As we only want to add events for when an email is changed, we need to store the previous email if we want a complete log of all emails for a member
This commit is contained in:
Rishabh Garg 2021-02-12 21:45:31 +05:30 committed by GitHub
parent 2f547b2974
commit 1d281581eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@ const {addTable} = require('../../utils');
module.exports = addTable('members_email_change_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
to_email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
from_email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
created_at: {type: 'dateTime', nullable: false}
});

View File

@ -372,7 +372,8 @@ module.exports = {
members_email_change_events: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
to_email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
from_email: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
created_at: {type: 'dateTime', nullable: false}
},
members_status_events: {

View File

@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '860fafa2fc5f78df158ddd8254d4993b';
const currentSchemaHash = '3f88f2c34001cc34d74d945dbf4f0bb5';
const currentFixturesHash = '370d0da0ab7c45050b2ff30bce8896ba';
const currentSettingsHash = '162f9294cc427eb32bc0577006c385ce';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';