ghost 5.18.0 → 5.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/tryghost-adapter-manager-5.19.1.tgz +0 -0
- package/components/tryghost-api-framework-5.19.1.tgz +0 -0
- package/components/tryghost-api-version-compatibility-service-5.19.1.tgz +0 -0
- package/components/tryghost-audience-feedback-5.19.1.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.19.1.tgz +0 -0
- package/components/tryghost-constants-5.19.1.tgz +0 -0
- package/components/tryghost-custom-theme-settings-service-5.19.1.tgz +0 -0
- package/components/tryghost-domain-events-5.19.1.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.19.1.tgz +0 -0
- package/components/tryghost-email-analytics-service-5.19.1.tgz +0 -0
- package/components/tryghost-email-content-generator-5.19.1.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.19.1.tgz +0 -0
- package/components/tryghost-extract-api-key-5.19.1.tgz +0 -0
- package/components/tryghost-html-to-plaintext-5.19.1.tgz +0 -0
- package/components/{tryghost-job-manager-5.18.0.tgz → tryghost-job-manager-5.19.1.tgz} +0 -0
- package/components/tryghost-link-redirects-5.19.1.tgz +0 -0
- package/components/tryghost-link-replacer-5.19.1.tgz +0 -0
- package/components/tryghost-link-tracking-5.19.1.tgz +0 -0
- package/components/{tryghost-magic-link-5.18.0.tgz → tryghost-magic-link-5.19.1.tgz} +0 -0
- package/components/tryghost-mailgun-client-5.19.1.tgz +0 -0
- package/components/tryghost-member-analytics-service-5.19.1.tgz +0 -0
- package/components/tryghost-member-attribution-5.19.1.tgz +0 -0
- package/components/tryghost-member-events-5.19.1.tgz +0 -0
- package/components/tryghost-members-analytics-ingress-5.19.1.tgz +0 -0
- package/components/tryghost-members-api-5.19.1.tgz +0 -0
- package/components/tryghost-members-csv-5.19.1.tgz +0 -0
- package/components/tryghost-members-events-service-5.19.1.tgz +0 -0
- package/components/tryghost-members-importer-5.19.1.tgz +0 -0
- package/components/tryghost-members-offers-5.19.1.tgz +0 -0
- package/components/tryghost-members-payments-5.19.1.tgz +0 -0
- package/components/tryghost-members-ssr-5.19.1.tgz +0 -0
- package/components/tryghost-members-stripe-service-5.19.1.tgz +0 -0
- package/components/tryghost-minifier-5.19.1.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.19.1.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.19.1.tgz +0 -0
- package/components/{tryghost-mw-error-handler-5.18.0.tgz → tryghost-mw-error-handler-5.19.1.tgz} +0 -0
- package/components/tryghost-mw-session-from-token-5.19.1.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.19.1.tgz +0 -0
- package/components/tryghost-mw-vhost-5.19.1.tgz +0 -0
- package/components/tryghost-oembed-service-5.19.1.tgz +0 -0
- package/components/tryghost-package-json-5.19.1.tgz +0 -0
- package/components/{tryghost-referrers-5.18.0.tgz → tryghost-referrers-5.19.1.tgz} +0 -0
- package/components/tryghost-security-5.19.1.tgz +0 -0
- package/components/tryghost-session-service-5.19.1.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.19.1.tgz +0 -0
- package/components/tryghost-staff-service-5.19.1.tgz +0 -0
- package/components/tryghost-stats-service-5.19.1.tgz +0 -0
- package/components/tryghost-update-check-service-5.19.1.tgz +0 -0
- package/components/tryghost-verification-trigger-5.19.1.tgz +0 -0
- package/components/tryghost-version-notifications-data-service-5.19.1.tgz +0 -0
- package/core/boot.js +3 -1
- package/core/built/admin/assets/{chunk.143.6d23a3157dae7a9c899d.js → chunk.143.af6972210ca7d2bfdcff.js} +6 -6
- package/core/built/admin/assets/{chunk.174.e997dfffceeaa0ce4636.js → chunk.174.3a133d51d9b45097c101.js} +31 -31
- package/core/built/admin/assets/{chunk.178.52a9ca26217a593eda67.js → chunk.178.6f68a314b66338b41c62.js} +4 -4
- package/core/built/admin/assets/{chunk.427.4483d5bbdaf2a65888ac.js → chunk.613.f1d519ad47e7f9024263.js} +40 -47
- package/core/built/admin/assets/{chunk.427.4483d5bbdaf2a65888ac.js.LICENSE.txt → chunk.613.f1d519ad47e7f9024263.js.LICENSE.txt} +0 -0
- package/core/built/admin/assets/{ghost-7e6e9479705e7e772bb5ea3b6476cd52.js → ghost-5ce6f5a730c83c91fc258b12c537ea35.js} +555 -559
- package/core/built/admin/assets/{ghost-ff0bee94743aa886ce35305a5b46fac3.css → ghost-982146a4ada3a5af1981d1919ae01d08.css} +1 -1
- package/core/built/admin/assets/{ghost-dark-a41f7645a406e0df78b7152f3f805e66.css → ghost-dark-41929e4857de411a23597a9de49a4e4f.css} +1 -1
- package/core/built/admin/assets/{vendor-4da5d2584fbe1442e25e4271a5513f1c.js → vendor-5c7d7063620bec13668c4370145cd4b4.js} +41 -34
- package/core/built/admin/index.html +6 -6
- package/core/frontend/helpers/t.js +12 -0
- package/core/frontend/helpers/tpl/content-cta.hbs +1 -1
- package/core/frontend/public/robots.txt +1 -0
- package/core/frontend/services/sitemap/handler.js +1 -1
- package/core/frontend/services/sitemap/index-generator.js +1 -3
- package/core/frontend/src/comment-counts/js/comment-counts.js +8 -0
- package/core/server/api/endpoints/feedback-members.js +23 -0
- package/core/server/api/endpoints/index.js +5 -1
- package/core/server/api/endpoints/utils/serializers/input/posts.js +6 -1
- package/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +8 -0
- package/core/server/data/exporter/table-lists.js +3 -1
- package/core/server/data/importer/handlers/json.js +21 -23
- package/core/server/data/importer/importers/data/base.js +1 -1
- package/core/server/data/migrations/versions/4.0/05-add-members-subscribe-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.0/06-populate-members-subscribe-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.0/11-add-members-paid-subscription-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.0/13-add-members-payment-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.0/17-populate-members-status-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.0/22-solve-orphaned-webhooks.js +1 -1
- package/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js +1 -1
- package/core/server/data/migrations/versions/4.11/02-add-email-verification-required-setting.js +1 -1
- package/core/server/data/migrations/versions/4.12/01-add-email-only-column-to-posts-meta-table.js +1 -1
- package/core/server/data/migrations/versions/4.3/03-add-default-product.js +1 -1
- package/core/server/data/migrations/versions/4.3/04-attach-members-to-product.js +1 -1
- package/core/server/data/migrations/versions/4.3/06-add-stripe-prices-table.js +2 -2
- package/core/server/data/migrations/versions/4.3/08-migrate-members-signup-setting.js +1 -1
- package/core/server/data/migrations/versions/4.33/2022-01-14-11-51-add-default-free-tier.js +1 -1
- package/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js +2 -2
- package/core/server/data/migrations/versions/4.43/2022-03-28-19-26-recreate-newsletter-table.js +5 -5
- package/core/server/data/migrations/versions/4.46/2022-04-13-13-00-add-default-newsletter.js +1 -1
- package/core/server/data/migrations/versions/4.46/2022-04-20-08-39-map-subscribers-to-default-newsletter.js +1 -1
- package/core/server/data/migrations/versions/4.7/03-add-labs-setting.js +1 -1
- package/core/server/data/migrations/versions/4.8/03-add-default-product-portal-products.js +1 -1
- package/core/server/data/migrations/versions/4.8/04-migrate-show-newsletter-header-setting.js +1 -1
- package/core/server/data/migrations/versions/5.0/2022-05-06-13-22-add-frontend-integration.js +1 -1
- package/core/server/data/migrations/versions/5.17/2022-09-29-12-39-add-track-clicks-column-to-emails.js +2 -2
- package/core/server/data/migrations/versions/5.19/2022-09-02-20-25-add-columns-to-products-table.js +19 -0
- package/core/server/data/migrations/versions/5.19/2022-09-02-20-52-backfill-new-product-columns.js +37 -0
- package/core/server/data/migrations/versions/5.19/2022-10-10-06-58-add-subscriptions-table.js +19 -0
- package/core/server/data/migrations/versions/5.19/2022-10-10-10-05-add-members-feedback-table.js +10 -0
- package/core/server/data/migrations/versions/5.19/2022-10-11-10-38-add-feedback-enabled-column-to-newsletters.js +7 -0
- package/core/server/data/schema/commands.js +3 -3
- package/core/server/data/schema/fixtures/fixtures.json +4 -1
- package/core/server/data/schema/schema.js +90 -24
- package/core/server/data/schema/validator.js +1 -1
- package/core/server/models/base/bookshelf.js +3 -4
- package/core/server/models/base/plugins/data-manipulation.js +1 -1
- package/core/server/models/base/plugins/events.js +1 -1
- package/core/server/models/base/utils.js +1 -1
- package/core/server/models/member-feedback.js +22 -0
- package/core/server/models/newsletter.js +3 -2
- package/core/server/models/post.js +24 -0
- package/core/server/models/settings.js +1 -1
- package/core/server/models/user.js +1 -1
- package/core/server/services/audience-feedback/FeedbackRepository.js +67 -0
- package/core/server/services/audience-feedback/index.js +33 -0
- package/core/server/services/bulk-email/bulk-email-processor.js +7 -1
- package/core/server/services/mail/GhostMailer.js +17 -1
- package/core/server/services/mega/feedback-buttons.js +69 -0
- package/core/server/services/mega/mega.js +1 -1
- package/core/server/services/mega/post-email-serializer.js +24 -4
- package/core/server/services/mega/template.js +3 -0
- package/core/server/services/members/middleware.js +40 -0
- package/core/server/services/notifications/notifications.js +1 -1
- package/core/server/services/settings/settings-service.js +1 -1
- package/core/server/services/themes/storage.js +1 -1
- package/core/server/web/members/app.js +12 -0
- package/core/shared/labs.js +4 -2
- package/package.json +111 -111
- package/yarn.lock +585 -498
- package/components/tryghost-adapter-manager-5.18.0.tgz +0 -0
- package/components/tryghost-api-framework-5.18.0.tgz +0 -0
- package/components/tryghost-api-version-compatibility-service-5.18.0.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.18.0.tgz +0 -0
- package/components/tryghost-constants-5.18.0.tgz +0 -0
- package/components/tryghost-custom-theme-settings-service-5.18.0.tgz +0 -0
- package/components/tryghost-domain-events-5.18.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.18.0.tgz +0 -0
- package/components/tryghost-email-analytics-service-5.18.0.tgz +0 -0
- package/components/tryghost-email-content-generator-5.18.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.18.0.tgz +0 -0
- package/components/tryghost-extract-api-key-5.18.0.tgz +0 -0
- package/components/tryghost-html-to-plaintext-5.18.0.tgz +0 -0
- package/components/tryghost-link-redirects-5.18.0.tgz +0 -0
- package/components/tryghost-link-replacer-5.18.0.tgz +0 -0
- package/components/tryghost-link-tracking-5.18.0.tgz +0 -0
- package/components/tryghost-mailgun-client-5.18.0.tgz +0 -0
- package/components/tryghost-member-analytics-service-5.18.0.tgz +0 -0
- package/components/tryghost-member-attribution-5.18.0.tgz +0 -0
- package/components/tryghost-member-events-5.18.0.tgz +0 -0
- package/components/tryghost-members-analytics-ingress-5.18.0.tgz +0 -0
- package/components/tryghost-members-api-5.18.0.tgz +0 -0
- package/components/tryghost-members-csv-5.18.0.tgz +0 -0
- package/components/tryghost-members-events-service-5.18.0.tgz +0 -0
- package/components/tryghost-members-importer-5.18.0.tgz +0 -0
- package/components/tryghost-members-offers-5.18.0.tgz +0 -0
- package/components/tryghost-members-payments-5.18.0.tgz +0 -0
- package/components/tryghost-members-ssr-5.18.0.tgz +0 -0
- package/components/tryghost-members-stripe-service-5.18.0.tgz +0 -0
- package/components/tryghost-minifier-5.18.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.18.0.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.18.0.tgz +0 -0
- package/components/tryghost-mw-session-from-token-5.18.0.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.18.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.18.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.18.0.tgz +0 -0
- package/components/tryghost-package-json-5.18.0.tgz +0 -0
- package/components/tryghost-security-5.18.0.tgz +0 -0
- package/components/tryghost-session-service-5.18.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.18.0.tgz +0 -0
- package/components/tryghost-staff-service-5.18.0.tgz +0 -0
- package/components/tryghost-stats-service-5.18.0.tgz +0 -0
- package/components/tryghost-update-check-service-5.18.0.tgz +0 -0
- package/components/tryghost-verification-trigger-5.18.0.tgz +0 -0
- package/components/tryghost-version-notifications-data-service-5.18.0.tgz +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
|
-
const Promise = require('bluebird');
|
|
3
2
|
const fs = require('fs-extra');
|
|
4
3
|
const tpl = require('@tryghost/tpl');
|
|
5
4
|
const errors = require('@tryghost/errors');
|
|
@@ -17,36 +16,35 @@ JSONHandler = {
|
|
|
17
16
|
contentTypes: ['application/octet-stream', 'application/json'],
|
|
18
17
|
directories: [],
|
|
19
18
|
|
|
20
|
-
loadFile: function (files, startDir) { // eslint-disable-line no-unused-vars
|
|
19
|
+
loadFile: async function (files, startDir) { // eslint-disable-line no-unused-vars
|
|
21
20
|
// @TODO: Handle multiple JSON files
|
|
22
21
|
const filePath = files[0].path;
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const fileData = await fs.readFile(filePath);
|
|
24
|
+
let importData;
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
try {
|
|
27
|
+
importData = JSON.parse(fileData);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
importData = importData.db[0];
|
|
29
|
+
// if importData follows JSON-API format `{ db: [exportedData] }`
|
|
30
|
+
if (_.keys(importData).length === 1) {
|
|
31
|
+
if (!importData.db || !Array.isArray(importData.db)) {
|
|
32
|
+
throw new errors.InternalServerError({
|
|
33
|
+
message: tpl(messages.invalidJsonFormat)
|
|
34
|
+
});
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
} catch (err) {
|
|
43
|
-
return Promise.reject(new errors.BadRequestError({
|
|
44
|
-
err: err,
|
|
45
|
-
message: err.message,
|
|
46
|
-
help: tpl(messages.checkImportJsonIsValid)
|
|
47
|
-
}));
|
|
37
|
+
importData = importData.db[0];
|
|
48
38
|
}
|
|
49
|
-
|
|
39
|
+
|
|
40
|
+
return importData;
|
|
41
|
+
} catch (err) {
|
|
42
|
+
throw new errors.BadRequestError({
|
|
43
|
+
err,
|
|
44
|
+
message: err.message,
|
|
45
|
+
help: tpl(messages.checkImportJsonIsValid)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
50
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const debug = require('@tryghost/debug')('importer:base');
|
|
2
2
|
const _ = require('lodash');
|
|
3
3
|
const Promise = require('bluebird');
|
|
4
|
-
const ObjectId = require('bson-objectid');
|
|
4
|
+
const ObjectId = require('bson-objectid').default;
|
|
5
5
|
const errors = require('@tryghost/errors');
|
|
6
6
|
const {sequence} = require('@tryghost/promise');
|
|
7
7
|
const models = require('../../../../models');
|
|
@@ -3,7 +3,7 @@ const {addTable} = require('../../utils');
|
|
|
3
3
|
module.exports = addTable('members_subscribe_events', {
|
|
4
4
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
|
5
5
|
member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
|
|
6
|
-
subscribed: {type: '
|
|
6
|
+
subscribed: {type: 'boolean', nullable: false, defaultTo: true},
|
|
7
7
|
created_at: {type: 'dateTime', nullable: false},
|
|
8
8
|
source: {type: 'string', maxlength: 50, nullable: true}
|
|
9
9
|
});
|
package/core/server/data/migrations/versions/4.0/11-add-members-paid-subscription-events-table.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = addTable('members_paid_subscription_events', {
|
|
|
5
5
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
|
6
6
|
from_plan: {type: 'string', maxlength: 255, nullable: true},
|
|
7
7
|
to_plan: {type: 'string', maxlength: 255, nullable: true},
|
|
8
|
-
currency: {type: 'string',
|
|
8
|
+
currency: {type: 'string', maxlength: 191, nullable: false},
|
|
9
9
|
source: {type: 'string', maxlength: 50, nullable: false},
|
|
10
10
|
mrr_delta: {type: 'integer', nullable: false},
|
|
11
11
|
created_at: {type: 'dateTime', nullable: false}
|
|
@@ -4,7 +4,7 @@ module.exports = addTable('members_payment_events', {
|
|
|
4
4
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
|
5
5
|
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
|
6
6
|
amount: {type: 'integer', nullable: false},
|
|
7
|
-
currency: {type: 'string',
|
|
7
|
+
currency: {type: 'string', maxlength: 191, nullable: false},
|
|
8
8
|
source: {type: 'string', maxlength: 50, nullable: false},
|
|
9
9
|
created_at: {type: 'dateTime', nullable: false}
|
|
10
10
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {createIrreversibleMigration} = require('../../utils');
|
|
2
2
|
const logging = require('@tryghost/logging');
|
|
3
|
-
const ObjectID = require('bson-objectid');
|
|
3
|
+
const ObjectID = require('bson-objectid').default;
|
|
4
4
|
const security = require('@tryghost/security');
|
|
5
5
|
|
|
6
6
|
module.exports = createIrreversibleMigration(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const {chunk} = require('lodash');
|
|
2
|
-
const ObjectID = require('bson-objectid');
|
|
2
|
+
const ObjectID = require('bson-objectid').default;
|
|
3
3
|
const {createTransactionalMigration} = require('../../utils');
|
|
4
4
|
const logging = require('@tryghost/logging');
|
|
5
5
|
const errors = require('@tryghost/errors');
|
|
@@ -4,9 +4,9 @@ module.exports = addTable('stripe_prices', {
|
|
|
4
4
|
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
|
5
5
|
stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
|
|
6
6
|
stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'stripe_products.stripe_product_id', cascadeDelete: true},
|
|
7
|
-
active: {type: '
|
|
7
|
+
active: {type: 'boolean', nullable: false},
|
|
8
8
|
nickname: {type: 'string', maxlength: 50, nullable: true},
|
|
9
|
-
currency: {type: 'string',
|
|
9
|
+
currency: {type: 'string', maxlength: 191, nullable: false},
|
|
10
10
|
amount: {type: 'integer', nullable: false},
|
|
11
11
|
type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'recurring', validations: {isIn: [['recurring', 'one_time']]}},
|
|
12
12
|
interval: {type: 'string', maxlength: 50, nullable: true},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const logging = require('@tryghost/logging');
|
|
2
2
|
const {createTransactionalMigration} = require('../../utils');
|
|
3
|
-
const ObjectId = require('bson-objectid');
|
|
3
|
+
const ObjectId = require('bson-objectid').default;
|
|
4
4
|
|
|
5
5
|
module.exports = createTransactionalMigration(
|
|
6
6
|
async function up(connection) {
|
|
@@ -12,7 +12,7 @@ module.exports = addTable('newsletters', {
|
|
|
12
12
|
sender_name: {type: 'string', maxlength: 191, nullable: false},
|
|
13
13
|
sender_email: {type: 'string', maxlength: 191, nullable: false, validations: {isEmail: true}},
|
|
14
14
|
sender_reply_to: {type: 'string', maxlength: 191, nullable: false, validations: {isEmail: true}},
|
|
15
|
-
default: {type: '
|
|
15
|
+
default: {type: 'boolean', nullable: false, defaultTo: false},
|
|
16
16
|
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'active'},
|
|
17
17
|
recipient_filter: {
|
|
18
18
|
type: 'text',
|
|
@@ -20,6 +20,6 @@ module.exports = addTable('newsletters', {
|
|
|
20
20
|
nullable: false,
|
|
21
21
|
defaultTo: ''
|
|
22
22
|
},
|
|
23
|
-
subscribe_on_signup: {type: '
|
|
23
|
+
subscribe_on_signup: {type: 'boolean', nullable: false, defaultTo: false},
|
|
24
24
|
sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0}
|
|
25
25
|
});
|
package/core/server/data/migrations/versions/4.43/2022-03-28-19-26-recreate-newsletter-table.js
CHANGED
|
@@ -15,15 +15,15 @@ module.exports = recreateTable('newsletters', {
|
|
|
15
15
|
nullable: false,
|
|
16
16
|
defaultTo: 'members'
|
|
17
17
|
},
|
|
18
|
-
subscribe_on_signup: {type: '
|
|
18
|
+
subscribe_on_signup: {type: 'boolean', nullable: false, defaultTo: true},
|
|
19
19
|
sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0},
|
|
20
20
|
header_image: {type: 'string', maxlength: 2000, nullable: true},
|
|
21
|
-
show_header_icon: {type: '
|
|
22
|
-
show_header_title: {type: '
|
|
21
|
+
show_header_icon: {type: 'boolean', nullable: false, defaultTo: true},
|
|
22
|
+
show_header_title: {type: 'boolean', nullable: false, defaultTo: true},
|
|
23
23
|
title_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}},
|
|
24
24
|
title_alignment: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'center', validations: {isIn: [['center', 'left']]}},
|
|
25
|
-
show_feature_image: {type: '
|
|
25
|
+
show_feature_image: {type: 'boolean', nullable: false, defaultTo: true},
|
|
26
26
|
body_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}},
|
|
27
27
|
footer_content: {type: 'text', maxlength: 1000000000, nullable: true},
|
|
28
|
-
show_badge: {type: '
|
|
28
|
+
show_badge: {type: 'boolean', nullable: false, defaultTo: true}
|
|
29
29
|
});
|
package/core/server/data/migrations/versions/4.8/04-migrate-show-newsletter-header-setting.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const logging = require('@tryghost/logging');
|
|
2
2
|
const {createTransactionalMigration} = require('../../utils');
|
|
3
|
-
const ObjectId = require('bson-objectid');
|
|
3
|
+
const ObjectId = require('bson-objectid').default;
|
|
4
4
|
|
|
5
5
|
// newsletter_show_header = false ->
|
|
6
6
|
// newsletter_show_header_title = false
|
package/core/server/data/migrations/versions/5.19/2022-09-02-20-25-add-columns-to-products-table.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
|
|
2
|
+
|
|
3
|
+
module.exports = combineNonTransactionalMigrations(
|
|
4
|
+
createAddColumnMigration('products', 'monthly_price', {
|
|
5
|
+
type: 'integer',
|
|
6
|
+
unsigned: true,
|
|
7
|
+
nullable: true
|
|
8
|
+
}),
|
|
9
|
+
createAddColumnMigration('products', 'yearly_price', {
|
|
10
|
+
type: 'integer',
|
|
11
|
+
unsigned: true,
|
|
12
|
+
nullable: true
|
|
13
|
+
}),
|
|
14
|
+
createAddColumnMigration('products', 'currency', {
|
|
15
|
+
type: 'string',
|
|
16
|
+
maxlength: 50,
|
|
17
|
+
nullable: true
|
|
18
|
+
})
|
|
19
|
+
);
|
package/core/server/data/migrations/versions/5.19/2022-09-02-20-52-backfill-new-product-columns.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const logging = require('@tryghost/logging');
|
|
2
|
+
|
|
3
|
+
const {createTransactionalMigration} = require('../../utils');
|
|
4
|
+
|
|
5
|
+
module.exports = createTransactionalMigration(
|
|
6
|
+
async function up(knex) {
|
|
7
|
+
const rows = await knex('products as t') // eslint-disable-line no-restricted-syntax
|
|
8
|
+
.select(
|
|
9
|
+
't.id as id',
|
|
10
|
+
'mp.amount as monthly_price',
|
|
11
|
+
'yp.amount as yearly_price',
|
|
12
|
+
knex.raw('coalesce(yp.currency, mp.currency) as currency')
|
|
13
|
+
)
|
|
14
|
+
.leftJoin('stripe_prices AS mp', 't.monthly_price_id', 'mp.id')
|
|
15
|
+
.leftJoin('stripe_prices AS yp', 't.yearly_price_id', 'yp.id')
|
|
16
|
+
.where('t.type', 'paid');
|
|
17
|
+
|
|
18
|
+
if (!rows.length) {
|
|
19
|
+
logging.info('Did not find any active paid Tiers');
|
|
20
|
+
return;
|
|
21
|
+
} else {
|
|
22
|
+
logging.info(`Updating ${rows.length} Tiers with price and currency information`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const row of rows) { // eslint-disable-line no-restricted-syntax
|
|
26
|
+
await knex('products').update(row).where('id', row.id);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
async function down(knex) {
|
|
30
|
+
logging.info('Removing currency and price information for all tiers');
|
|
31
|
+
await knex('products').update({
|
|
32
|
+
currency: null,
|
|
33
|
+
monthly_price: null,
|
|
34
|
+
yearly_price: null
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const {addTable} = require('../../utils');
|
|
2
|
+
|
|
3
|
+
module.exports = addTable('subscriptions', {
|
|
4
|
+
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
|
5
|
+
type: {type: 'string', maxlength: 50, nullable: false},
|
|
6
|
+
status: {type: 'string', maxlength: 50, nullable: false},
|
|
7
|
+
member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
|
|
8
|
+
tier_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'products.id'},
|
|
9
|
+
cadence: {type: 'string', maxlength: 50, nullable: true},
|
|
10
|
+
currency: {type: 'string', maxlength: 50, nullable: true},
|
|
11
|
+
amount: {type: 'integer', nullable: true},
|
|
12
|
+
payment_provider: {type: 'string', maxlength: 50, nullable: true},
|
|
13
|
+
payment_subscription_url: {type: 'string', maxlength: 2000, nullable: true},
|
|
14
|
+
payment_user_url: {type: 'string', maxlength: 2000, nullable: true},
|
|
15
|
+
offer_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'offers.id'},
|
|
16
|
+
expires_at: {type: 'dateTime', nullable: true},
|
|
17
|
+
created_at: {type: 'dateTime', nullable: false},
|
|
18
|
+
updated_at: {type: 'dateTime', nullable: true}
|
|
19
|
+
});
|
package/core/server/data/migrations/versions/5.19/2022-10-10-10-05-add-members-feedback-table.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const {addTable} = require('../../utils');
|
|
2
|
+
|
|
3
|
+
module.exports = addTable('members_feedback', {
|
|
4
|
+
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
|
5
|
+
score: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0},
|
|
6
|
+
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
|
7
|
+
post_id: {type: 'string', maxlength: 24, nullable: false, references: 'posts.id', cascadeDelete: true},
|
|
8
|
+
created_at: {type: 'dateTime', nullable: false},
|
|
9
|
+
updated_at: {type: 'dateTime', nullable: true}
|
|
10
|
+
});
|
|
@@ -126,7 +126,7 @@ async function dropColumn(tableName, column, transaction = db.knex, columnSpec =
|
|
|
126
126
|
* Adds an unique index to a table over the given columns.
|
|
127
127
|
*
|
|
128
128
|
* @param {string} tableName - name of the table to add unique constraint to
|
|
129
|
-
* @param {string|[
|
|
129
|
+
* @param {string|string[]} columns - column(s) to form unique constraint with
|
|
130
130
|
* @param {import('knex')} transaction - connection object containing knex reference
|
|
131
131
|
*/
|
|
132
132
|
async function addUnique(tableName, columns, transaction = db.knex) {
|
|
@@ -153,7 +153,7 @@ async function addUnique(tableName, columns, transaction = db.knex) {
|
|
|
153
153
|
* Drops a unique key constraint from a table.
|
|
154
154
|
*
|
|
155
155
|
* @param {string} tableName - name of the table to drop unique constraint from
|
|
156
|
-
* @param {string|[
|
|
156
|
+
* @param {string|string[]} columns - column(s) unique constraint was formed
|
|
157
157
|
* @param {import('knex')} transaction - connection object containing knex reference
|
|
158
158
|
*/
|
|
159
159
|
async function dropUnique(tableName, columns, transaction = db.knex) {
|
|
@@ -327,7 +327,7 @@ async function hasPrimaryKeySQLite(tableName, transaction = db.knex) {
|
|
|
327
327
|
* Adds an primary key index to a table over the given columns.
|
|
328
328
|
*
|
|
329
329
|
* @param {string} tableName - name of the table to add primaykey constraint to
|
|
330
|
-
* @param {string|[
|
|
330
|
+
* @param {string|string[]} columns - column(s) to form primary key constraint with
|
|
331
331
|
* @param {import('knex')} transaction - connection object containing knex reference
|
|
332
332
|
*/
|
|
333
333
|
async function addPrimaryKey(tableName, columns, transaction = db.knex) {
|