diff --git a/core/server/data/migrations/versions/4.0/05-add-members-subscribe-events-table.js b/core/server/data/migrations/versions/4.0/05-add-members-subscribe-events-table.js new file mode 100644 index 0000000000..a4997f630a --- /dev/null +++ b/core/server/data/migrations/versions/4.0/05-add-members-subscribe-events-table.js @@ -0,0 +1,9 @@ +const {addTable} = require('../../utils'); + +module.exports = addTable('members_subscribe_events', { + id: {type: 'string', maxlength: 24, nullable: false, primary: true}, + member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true}, + subscribed: {type: 'bool', nullable: false, defaultTo: true}, + created_at: {type: 'dateTime', nullable: false}, + source: {type: 'string', maxlength: 50, nullable: true} +}); diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index 7cf3062a84..53e20c0136 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -397,6 +397,13 @@ module.exports = { plan_amount: {type: 'integer', nullable: false}, plan_currency: {type: 'string', maxLength: 3, nullable: false} }, + members_subscribe_events: { + id: {type: 'string', maxlength: 24, nullable: false, primary: true}, + member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true}, + subscribed: {type: 'bool', nullable: false, defaultTo: true}, + created_at: {type: 'dateTime', nullable: false}, + source: {type: 'string', maxlength: 50, nullable: true} + }, actions: { id: {type: 'string', maxlength: 24, nullable: false, primary: true}, resource_id: {type: 'string', maxlength: 24, nullable: true}, diff --git a/test/api-acceptance/admin/db_spec.js b/test/api-acceptance/admin/db_spec.js index 9f64f1a041..6b675d4533 100644 --- a/test/api-acceptance/admin/db_spec.js +++ b/test/api-acceptance/admin/db_spec.js @@ -47,7 +47,7 @@ describe('DB API', function () { const jsonResponse = res.body; should.exist(jsonResponse.db); jsonResponse.db.should.have.length(1); - Object.keys(jsonResponse.db[0].data).length.should.eql(28); + Object.keys(jsonResponse.db[0].data).length.should.eql(29); }); it('Can import a JSON database', async function () { diff --git a/test/unit/data/schema/integrity_spec.js b/test/unit/data/schema/integrity_spec.js index 74fcaae933..d5d4e39e18 100644 --- a/test/unit/data/schema/integrity_spec.js +++ b/test/unit/data/schema/integrity_spec.js @@ -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 = '0970e14fcf8d91daaf636da382e3da29'; + const currentSchemaHash = '41fb7edf55c023f7b21fc5f3b7899d0f'; const currentFixturesHash = '370d0da0ab7c45050b2ff30bce8896ba'; const currentSettingsHash = '162f9294cc427eb32bc0577006c385ce'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';