Added benefits table

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

Benefits are tag-like resources which will be associated with Products.
The first iteration just requires a name for the benefit, which will be
stored as plaintext.
This commit is contained in:
Fabien O'Carroll 2021-06-24 10:41:36 +01:00
parent 53b7eb227b
commit 65b2e8a0a5
5 changed files with 19 additions and 1 deletions

View File

@ -18,6 +18,7 @@ const BACKUP_TABLES = [
'permissions_roles',
'permissions_users',
'products',
'benefits',
'webhooks',
'snippets',
'tokens',

View File

@ -0,0 +1,9 @@
const {addTable} = require('../../utils');
module.exports = addTable('benefits', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
name: {type: 'string', maxlength: 191, nullable: false},
slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: true}
});

View File

@ -373,6 +373,13 @@ module.exports = {
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: true}
},
benefits: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
name: {type: 'string', maxlength: 191, nullable: false},
slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
created_at: {type: 'dateTime', nullable: false},
updated_at: {type: 'dateTime', nullable: true}
},
members_products: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},

View File

@ -53,6 +53,7 @@ describe('Exporter', function () {
'posts_meta',
'posts_tags',
'products',
'benefits',
'stripe_products',
'stripe_prices',
'roles',

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 = 'ef13a18aee78222086ca864c16bde696';
const currentSchemaHash = '92da283a364f19c4b3ec8ed25456e9b1';
const currentFixturesHash = '97283c575b1f6c84c27db6e1b1be21d4';
const currentSettingsHash = 'dd0a0a08e66b252e7704bb7e346a8c20';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';