ghost 5.18.0 → 5.19.0

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.
Files changed (175) hide show
  1. package/README.md +1 -1
  2. package/components/tryghost-adapter-manager-5.19.0.tgz +0 -0
  3. package/components/{tryghost-api-framework-5.18.0.tgz → tryghost-api-framework-5.19.0.tgz} +0 -0
  4. package/components/tryghost-api-version-compatibility-service-5.19.0.tgz +0 -0
  5. package/components/tryghost-audience-feedback-5.19.0.tgz +0 -0
  6. package/components/tryghost-bootstrap-socket-5.19.0.tgz +0 -0
  7. package/components/tryghost-constants-5.19.0.tgz +0 -0
  8. package/components/{tryghost-custom-theme-settings-service-5.18.0.tgz → tryghost-custom-theme-settings-service-5.19.0.tgz} +0 -0
  9. package/components/tryghost-domain-events-5.19.0.tgz +0 -0
  10. package/components/tryghost-email-analytics-provider-mailgun-5.19.0.tgz +0 -0
  11. package/components/tryghost-email-analytics-service-5.19.0.tgz +0 -0
  12. package/components/tryghost-email-content-generator-5.19.0.tgz +0 -0
  13. package/components/tryghost-express-dynamic-redirects-5.19.0.tgz +0 -0
  14. package/components/tryghost-extract-api-key-5.19.0.tgz +0 -0
  15. package/components/tryghost-html-to-plaintext-5.19.0.tgz +0 -0
  16. package/components/{tryghost-job-manager-5.18.0.tgz → tryghost-job-manager-5.19.0.tgz} +0 -0
  17. package/components/tryghost-link-redirects-5.19.0.tgz +0 -0
  18. package/components/tryghost-link-replacer-5.19.0.tgz +0 -0
  19. package/components/tryghost-link-tracking-5.19.0.tgz +0 -0
  20. package/components/{tryghost-magic-link-5.18.0.tgz → tryghost-magic-link-5.19.0.tgz} +0 -0
  21. package/components/tryghost-mailgun-client-5.19.0.tgz +0 -0
  22. package/components/tryghost-member-analytics-service-5.19.0.tgz +0 -0
  23. package/components/tryghost-member-attribution-5.19.0.tgz +0 -0
  24. package/components/tryghost-member-events-5.19.0.tgz +0 -0
  25. package/components/tryghost-members-analytics-ingress-5.19.0.tgz +0 -0
  26. package/components/tryghost-members-api-5.19.0.tgz +0 -0
  27. package/components/tryghost-members-csv-5.19.0.tgz +0 -0
  28. package/components/tryghost-members-events-service-5.19.0.tgz +0 -0
  29. package/components/tryghost-members-importer-5.19.0.tgz +0 -0
  30. package/components/tryghost-members-offers-5.19.0.tgz +0 -0
  31. package/components/tryghost-members-payments-5.19.0.tgz +0 -0
  32. package/components/tryghost-members-ssr-5.19.0.tgz +0 -0
  33. package/components/tryghost-members-stripe-service-5.19.0.tgz +0 -0
  34. package/components/tryghost-minifier-5.19.0.tgz +0 -0
  35. package/components/tryghost-mw-api-version-mismatch-5.19.0.tgz +0 -0
  36. package/components/tryghost-mw-cache-control-5.19.0.tgz +0 -0
  37. package/components/{tryghost-mw-error-handler-5.18.0.tgz → tryghost-mw-error-handler-5.19.0.tgz} +0 -0
  38. package/components/tryghost-mw-session-from-token-5.19.0.tgz +0 -0
  39. package/components/tryghost-mw-update-user-last-seen-5.19.0.tgz +0 -0
  40. package/components/tryghost-mw-vhost-5.19.0.tgz +0 -0
  41. package/components/tryghost-oembed-service-5.19.0.tgz +0 -0
  42. package/components/tryghost-package-json-5.19.0.tgz +0 -0
  43. package/components/tryghost-referrers-5.19.0.tgz +0 -0
  44. package/components/tryghost-security-5.19.0.tgz +0 -0
  45. package/components/tryghost-session-service-5.19.0.tgz +0 -0
  46. package/components/tryghost-settings-path-manager-5.19.0.tgz +0 -0
  47. package/components/tryghost-staff-service-5.19.0.tgz +0 -0
  48. package/components/tryghost-stats-service-5.19.0.tgz +0 -0
  49. package/components/tryghost-update-check-service-5.19.0.tgz +0 -0
  50. package/components/tryghost-verification-trigger-5.19.0.tgz +0 -0
  51. package/components/tryghost-version-notifications-data-service-5.19.0.tgz +0 -0
  52. package/core/boot.js +3 -1
  53. package/core/built/admin/assets/{chunk.143.6d23a3157dae7a9c899d.js → chunk.143.eaf838fbf1470f018bf3.js} +6 -6
  54. package/core/built/admin/assets/{chunk.174.e997dfffceeaa0ce4636.js → chunk.174.3a133d51d9b45097c101.js} +31 -31
  55. package/core/built/admin/assets/{chunk.178.52a9ca26217a593eda67.js → chunk.178.44dae8a74f7f9d606e06.js} +4 -4
  56. package/core/built/admin/assets/{chunk.427.4483d5bbdaf2a65888ac.js → chunk.613.f1d519ad47e7f9024263.js} +40 -47
  57. package/core/built/admin/assets/{chunk.427.4483d5bbdaf2a65888ac.js.LICENSE.txt → chunk.613.f1d519ad47e7f9024263.js.LICENSE.txt} +0 -0
  58. package/core/built/admin/assets/{ghost-7e6e9479705e7e772bb5ea3b6476cd52.js → ghost-5ce6f5a730c83c91fc258b12c537ea35.js} +555 -559
  59. package/core/built/admin/assets/{ghost-ff0bee94743aa886ce35305a5b46fac3.css → ghost-982146a4ada3a5af1981d1919ae01d08.css} +1 -1
  60. package/core/built/admin/assets/{ghost-dark-a41f7645a406e0df78b7152f3f805e66.css → ghost-dark-41929e4857de411a23597a9de49a4e4f.css} +1 -1
  61. package/core/built/admin/assets/{vendor-4da5d2584fbe1442e25e4271a5513f1c.js → vendor-5c7d7063620bec13668c4370145cd4b4.js} +41 -34
  62. package/core/built/admin/index.html +6 -6
  63. package/core/frontend/helpers/t.js +12 -0
  64. package/core/frontend/helpers/tpl/content-cta.hbs +1 -1
  65. package/core/frontend/public/robots.txt +1 -0
  66. package/core/frontend/services/sitemap/handler.js +1 -1
  67. package/core/frontend/services/sitemap/index-generator.js +1 -3
  68. package/core/server/api/endpoints/feedback-members.js +23 -0
  69. package/core/server/api/endpoints/index.js +5 -1
  70. package/core/server/api/endpoints/utils/serializers/input/posts.js +6 -1
  71. package/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +8 -0
  72. package/core/server/data/exporter/table-lists.js +3 -1
  73. package/core/server/data/importer/handlers/json.js +21 -23
  74. package/core/server/data/importer/importers/data/base.js +1 -1
  75. package/core/server/data/migrations/versions/4.0/05-add-members-subscribe-events-table.js +1 -1
  76. package/core/server/data/migrations/versions/4.0/06-populate-members-subscribe-events-table.js +1 -1
  77. package/core/server/data/migrations/versions/4.0/11-add-members-paid-subscription-events-table.js +1 -1
  78. package/core/server/data/migrations/versions/4.0/13-add-members-payment-events-table.js +1 -1
  79. package/core/server/data/migrations/versions/4.0/17-populate-members-status-events-table.js +1 -1
  80. package/core/server/data/migrations/versions/4.0/22-solve-orphaned-webhooks.js +1 -1
  81. package/core/server/data/migrations/versions/4.0/25-populate-members-paid-subscription-events-table.js +1 -1
  82. package/core/server/data/migrations/versions/4.11/02-add-email-verification-required-setting.js +1 -1
  83. package/core/server/data/migrations/versions/4.12/01-add-email-only-column-to-posts-meta-table.js +1 -1
  84. package/core/server/data/migrations/versions/4.3/03-add-default-product.js +1 -1
  85. package/core/server/data/migrations/versions/4.3/04-attach-members-to-product.js +1 -1
  86. package/core/server/data/migrations/versions/4.3/06-add-stripe-prices-table.js +2 -2
  87. package/core/server/data/migrations/versions/4.3/08-migrate-members-signup-setting.js +1 -1
  88. package/core/server/data/migrations/versions/4.33/2022-01-14-11-51-add-default-free-tier.js +1 -1
  89. package/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js +2 -2
  90. package/core/server/data/migrations/versions/4.43/2022-03-28-19-26-recreate-newsletter-table.js +5 -5
  91. package/core/server/data/migrations/versions/4.46/2022-04-13-13-00-add-default-newsletter.js +1 -1
  92. package/core/server/data/migrations/versions/4.46/2022-04-20-08-39-map-subscribers-to-default-newsletter.js +1 -1
  93. package/core/server/data/migrations/versions/4.7/03-add-labs-setting.js +1 -1
  94. package/core/server/data/migrations/versions/4.8/03-add-default-product-portal-products.js +1 -1
  95. package/core/server/data/migrations/versions/4.8/04-migrate-show-newsletter-header-setting.js +1 -1
  96. package/core/server/data/migrations/versions/5.0/2022-05-06-13-22-add-frontend-integration.js +1 -1
  97. package/core/server/data/migrations/versions/5.17/2022-09-29-12-39-add-track-clicks-column-to-emails.js +2 -2
  98. package/core/server/data/migrations/versions/5.19/2022-09-02-20-25-add-columns-to-products-table.js +19 -0
  99. package/core/server/data/migrations/versions/5.19/2022-09-02-20-52-backfill-new-product-columns.js +37 -0
  100. package/core/server/data/migrations/versions/5.19/2022-10-10-06-58-add-subscriptions-table.js +19 -0
  101. package/core/server/data/migrations/versions/5.19/2022-10-10-10-05-add-members-feedback-table.js +10 -0
  102. package/core/server/data/migrations/versions/5.19/2022-10-11-10-38-add-feedback-enabled-column-to-newsletters.js +7 -0
  103. package/core/server/data/schema/commands.js +3 -3
  104. package/core/server/data/schema/fixtures/fixtures.json +4 -1
  105. package/core/server/data/schema/schema.js +90 -24
  106. package/core/server/data/schema/validator.js +1 -1
  107. package/core/server/models/base/bookshelf.js +3 -4
  108. package/core/server/models/base/plugins/data-manipulation.js +1 -1
  109. package/core/server/models/base/plugins/events.js +1 -1
  110. package/core/server/models/base/utils.js +1 -1
  111. package/core/server/models/member-feedback.js +22 -0
  112. package/core/server/models/newsletter.js +3 -2
  113. package/core/server/models/post.js +24 -0
  114. package/core/server/models/settings.js +1 -1
  115. package/core/server/models/user.js +1 -1
  116. package/core/server/services/audience-feedback/FeedbackRepository.js +67 -0
  117. package/core/server/services/audience-feedback/index.js +33 -0
  118. package/core/server/services/bulk-email/bulk-email-processor.js +7 -1
  119. package/core/server/services/mail/GhostMailer.js +17 -1
  120. package/core/server/services/mega/feedback-buttons.js +69 -0
  121. package/core/server/services/mega/mega.js +1 -1
  122. package/core/server/services/mega/post-email-serializer.js +24 -4
  123. package/core/server/services/mega/template.js +3 -0
  124. package/core/server/services/members/middleware.js +40 -0
  125. package/core/server/services/notifications/notifications.js +1 -1
  126. package/core/server/services/settings/settings-service.js +1 -1
  127. package/core/server/services/themes/storage.js +1 -1
  128. package/core/server/web/members/app.js +12 -0
  129. package/core/shared/labs.js +4 -2
  130. package/package.json +110 -110
  131. package/yarn.lock +496 -432
  132. package/components/tryghost-adapter-manager-5.18.0.tgz +0 -0
  133. package/components/tryghost-api-version-compatibility-service-5.18.0.tgz +0 -0
  134. package/components/tryghost-bootstrap-socket-5.18.0.tgz +0 -0
  135. package/components/tryghost-constants-5.18.0.tgz +0 -0
  136. package/components/tryghost-domain-events-5.18.0.tgz +0 -0
  137. package/components/tryghost-email-analytics-provider-mailgun-5.18.0.tgz +0 -0
  138. package/components/tryghost-email-analytics-service-5.18.0.tgz +0 -0
  139. package/components/tryghost-email-content-generator-5.18.0.tgz +0 -0
  140. package/components/tryghost-express-dynamic-redirects-5.18.0.tgz +0 -0
  141. package/components/tryghost-extract-api-key-5.18.0.tgz +0 -0
  142. package/components/tryghost-html-to-plaintext-5.18.0.tgz +0 -0
  143. package/components/tryghost-link-redirects-5.18.0.tgz +0 -0
  144. package/components/tryghost-link-replacer-5.18.0.tgz +0 -0
  145. package/components/tryghost-link-tracking-5.18.0.tgz +0 -0
  146. package/components/tryghost-mailgun-client-5.18.0.tgz +0 -0
  147. package/components/tryghost-member-analytics-service-5.18.0.tgz +0 -0
  148. package/components/tryghost-member-attribution-5.18.0.tgz +0 -0
  149. package/components/tryghost-member-events-5.18.0.tgz +0 -0
  150. package/components/tryghost-members-analytics-ingress-5.18.0.tgz +0 -0
  151. package/components/tryghost-members-api-5.18.0.tgz +0 -0
  152. package/components/tryghost-members-csv-5.18.0.tgz +0 -0
  153. package/components/tryghost-members-events-service-5.18.0.tgz +0 -0
  154. package/components/tryghost-members-importer-5.18.0.tgz +0 -0
  155. package/components/tryghost-members-offers-5.18.0.tgz +0 -0
  156. package/components/tryghost-members-payments-5.18.0.tgz +0 -0
  157. package/components/tryghost-members-ssr-5.18.0.tgz +0 -0
  158. package/components/tryghost-members-stripe-service-5.18.0.tgz +0 -0
  159. package/components/tryghost-minifier-5.18.0.tgz +0 -0
  160. package/components/tryghost-mw-api-version-mismatch-5.18.0.tgz +0 -0
  161. package/components/tryghost-mw-cache-control-5.18.0.tgz +0 -0
  162. package/components/tryghost-mw-session-from-token-5.18.0.tgz +0 -0
  163. package/components/tryghost-mw-update-user-last-seen-5.18.0.tgz +0 -0
  164. package/components/tryghost-mw-vhost-5.18.0.tgz +0 -0
  165. package/components/tryghost-oembed-service-5.18.0.tgz +0 -0
  166. package/components/tryghost-package-json-5.18.0.tgz +0 -0
  167. package/components/tryghost-referrers-5.18.0.tgz +0 -0
  168. package/components/tryghost-security-5.18.0.tgz +0 -0
  169. package/components/tryghost-session-service-5.18.0.tgz +0 -0
  170. package/components/tryghost-settings-path-manager-5.18.0.tgz +0 -0
  171. package/components/tryghost-staff-service-5.18.0.tgz +0 -0
  172. package/components/tryghost-stats-service-5.18.0.tgz +0 -0
  173. package/components/tryghost-update-check-service-5.18.0.tgz +0 -0
  174. package/components/tryghost-verification-trigger-5.18.0.tgz +0 -0
  175. package/components/tryghost-version-notifications-data-service-5.18.0.tgz +0 -0
@@ -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: 'bool', nullable: false, defaultTo: true},
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
  });
@@ -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
 
@@ -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', maxLength: 3, nullable: false},
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', maxLength: 3, nullable: false},
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,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 logging = require('@tryghost/logging');
4
4
  const {createTransactionalMigration} = require('../../utils');
5
5
 
@@ -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');
@@ -1,4 +1,4 @@
1
- const ObjectID = require('bson-objectid');
1
+ const ObjectID = require('bson-objectid').default;
2
2
  const logging = require('@tryghost/logging');
3
3
  const {createTransactionalMigration} = require('../../utils');
4
4
 
@@ -1,7 +1,7 @@
1
1
  const {createAddColumnMigration} = require('../../utils');
2
2
 
3
3
  module.exports = createAddColumnMigration('posts_meta', 'email_only', {
4
- type: 'bool',
4
+ type: 'boolean',
5
5
  nullable: false,
6
6
  defaultTo: false
7
7
  });
@@ -1,5 +1,5 @@
1
1
  const {createTransactionalMigration} = require('../../utils');
2
- const ObjectID = require('bson-objectid');
2
+ const ObjectID = require('bson-objectid').default;
3
3
  const {slugify} = require('@tryghost/string');
4
4
  const logging = require('@tryghost/logging');
5
5
 
@@ -1,5 +1,5 @@
1
1
  const {createTransactionalMigration} = require('../../utils');
2
- const ObjectID = require('bson-objectid');
2
+ const ObjectID = require('bson-objectid').default;
3
3
  const {chunk} = require('lodash');
4
4
  const logging = require('@tryghost/logging');
5
5
 
@@ -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: 'bool', nullable: false},
7
+ active: {type: 'boolean', nullable: false},
8
8
  nickname: {type: 'string', maxlength: 50, nullable: true},
9
- currency: {type: 'string', maxLength: 3, nullable: false},
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) {
@@ -1,5 +1,5 @@
1
1
  const {createTransactionalMigration} = require('../../utils');
2
- const ObjectID = require('bson-objectid');
2
+ const ObjectID = require('bson-objectid').default;
3
3
  const {slugify} = require('@tryghost/string');
4
4
  const logging = require('@tryghost/logging');
5
5
 
@@ -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: 'bool', nullable: false, defaultTo: false},
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: 'bool', nullable: false, defaultTo: false},
23
+ subscribe_on_signup: {type: 'boolean', nullable: false, defaultTo: false},
24
24
  sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0}
25
25
  });
@@ -15,15 +15,15 @@ module.exports = recreateTable('newsletters', {
15
15
  nullable: false,
16
16
  defaultTo: 'members'
17
17
  },
18
- subscribe_on_signup: {type: 'bool', nullable: false, defaultTo: true},
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: 'bool', nullable: false, defaultTo: true},
22
- show_header_title: {type: 'bool', nullable: false, defaultTo: true},
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: 'bool', nullable: false, defaultTo: true},
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: 'bool', nullable: false, defaultTo: true}
28
+ show_badge: {type: 'boolean', nullable: false, defaultTo: true}
29
29
  });
@@ -1,4 +1,4 @@
1
- const ObjectId = require('bson-objectid');
1
+ const ObjectId = require('bson-objectid').default;
2
2
  const uuid = require('uuid');
3
3
  const logging = require('@tryghost/logging');
4
4
  const startsWith = require('lodash/startsWith');
@@ -1,5 +1,5 @@
1
1
  const logging = require('@tryghost/logging');
2
- const ObjectID = require('bson-objectid');
2
+ const ObjectID = require('bson-objectid').default;
3
3
 
4
4
  const {createTransactionalMigration} = require('../../utils');
5
5
 
@@ -1,4 +1,4 @@
1
- const ObjectID = require('bson-objectid');
1
+ const ObjectID = require('bson-objectid').default;
2
2
  const logging = require('@tryghost/logging');
3
3
  const {createTransactionalMigration} = require('../../utils');
4
4
 
@@ -1,4 +1,4 @@
1
- const ObjectID = require('bson-objectid');
1
+ const ObjectID = require('bson-objectid').default;
2
2
  const {createTransactionalMigration} = require('../../utils');
3
3
  const logging = require('@tryghost/logging');
4
4
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  const logging = require('@tryghost/logging');
2
- const ObjectID = require('bson-objectid');
2
+ const ObjectID = require('bson-objectid').default;
3
3
  const security = require('@tryghost/security');
4
4
  const {createTransactionalMigration} = require('../../utils');
5
5
 
@@ -1,7 +1,7 @@
1
1
  const {createAddColumnMigration} = require('../../utils');
2
2
 
3
3
  module.exports = createAddColumnMigration('emails', 'track_clicks', {
4
- type: 'bool',
5
- nullable: false,
4
+ type: 'boolean',
5
+ nullable: false,
6
6
  defaultTo: false
7
7
  });
@@ -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
+ );
@@ -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
+ });
@@ -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
+ });
@@ -0,0 +1,7 @@
1
+ const {createAddColumnMigration} = require('../../utils');
2
+
3
+ module.exports = createAddColumnMigration('newsletters', 'feedback_enabled', {
4
+ type: 'boolean',
5
+ nullable: false,
6
+ defaultTo: false
7
+ });
@@ -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|[string]} columns - column(s) to form unique constraint with
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|[string]} columns - column(s) unique constraint was formed
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|[string]} columns - column(s) to form primary key constraint with
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) {
@@ -15,7 +15,10 @@
15
15
  "slug": "default-product",
16
16
  "type": "paid",
17
17
  "active": true,
18
- "visibility": "public"
18
+ "visibility": "public",
19
+ "currency": "usd",
20
+ "monthly_price": 500,
21
+ "yearly_price": 5000
19
22
  }
20
23
  ]
21
24
  },
@@ -13,6 +13,7 @@ module.exports = {
13
13
  uuid: {type: 'string', maxlength: 36, nullable: false, unique: true, validations: {isUUID: true}},
14
14
  name: {type: 'string', maxlength: 191, nullable: false, unique: true},
15
15
  description: {type: 'string', maxlength: 2000, nullable: true},
16
+ feedback_enabled: {type: 'boolean', nullable: false, defaultTo: false},
16
17
  slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
17
18
  sender_name: {type: 'string', maxlength: 191, nullable: true},
18
19
  sender_email: {type: 'string', maxlength: 191, nullable: true},
@@ -24,18 +25,18 @@ module.exports = {
24
25
  nullable: false,
25
26
  defaultTo: 'members'
26
27
  },
27
- subscribe_on_signup: {type: 'bool', nullable: false, defaultTo: true},
28
+ subscribe_on_signup: {type: 'boolean', nullable: false, defaultTo: true},
28
29
  sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0},
29
30
  header_image: {type: 'string', maxlength: 2000, nullable: true},
30
- show_header_icon: {type: 'bool', nullable: false, defaultTo: true},
31
- show_header_title: {type: 'bool', nullable: false, defaultTo: true},
31
+ show_header_icon: {type: 'boolean', nullable: false, defaultTo: true},
32
+ show_header_title: {type: 'boolean', nullable: false, defaultTo: true},
32
33
  title_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}},
33
34
  title_alignment: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'center', validations: {isIn: [['center', 'left']]}},
34
- show_feature_image: {type: 'bool', nullable: false, defaultTo: true},
35
+ show_feature_image: {type: 'boolean', nullable: false, defaultTo: true},
35
36
  body_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}},
36
37
  footer_content: {type: 'text', maxlength: 1000000000, nullable: true},
37
- show_badge: {type: 'bool', nullable: false, defaultTo: true},
38
- show_header_name: {type: 'bool', nullable: false, defaultTo: true},
38
+ show_badge: {type: 'boolean', nullable: false, defaultTo: true},
39
+ show_header_name: {type: 'boolean', nullable: false, defaultTo: true},
39
40
  created_at: {type: 'dateTime', nullable: false},
40
41
  updated_at: {type: 'dateTime', nullable: true}
41
42
  },
@@ -50,7 +51,7 @@ module.exports = {
50
51
  comment_id: {type: 'string', maxlength: 50, nullable: true},
51
52
  plaintext: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: true},
52
53
  feature_image: {type: 'string', maxlength: 2000, nullable: true},
53
- featured: {type: 'bool', nullable: false, defaultTo: false},
54
+ featured: {type: 'boolean', nullable: false, defaultTo: false},
54
55
  type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'post', validations: {isIn: [['post', 'page']]}},
55
56
  status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'draft', validations: {isIn: [['published', 'draft', 'scheduled', 'sent']]}},
56
57
  // NOTE: unused at the moment and reserved for future features
@@ -102,7 +103,7 @@ module.exports = {
102
103
  frontmatter: {type: 'text', maxlength: 65535, nullable: true},
103
104
  feature_image_alt: {type: 'string', maxlength: 191, nullable: true, validations: {isLength: {max: 125}}},
104
105
  feature_image_caption: {type: 'text', maxlength: 65535, nullable: true},
105
- email_only: {type: 'bool', nullable: false, defaultTo: false}
106
+ email_only: {type: 'boolean', nullable: false, defaultTo: false}
106
107
  },
107
108
  // NOTE: this is the staff table
108
109
  users: {
@@ -423,7 +424,7 @@ module.exports = {
423
424
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
424
425
  name: {type: 'string', maxlength: 191, nullable: false},
425
426
  slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
426
- // @deprecated: use a status enum with isIn validation, not aan ctive boolean
427
+ // @deprecated: use a status enum with isIn validation, not an `active` boolean
427
428
  active: {type: 'boolean', nullable: false, defaultTo: true},
428
429
  welcome_page_url: {type: 'string', maxlength: 2000, nullable: true},
429
430
  visibility: {
@@ -434,16 +435,28 @@ module.exports = {
434
435
  validations: {isIn: [['public', 'none']]}
435
436
  },
436
437
  trial_days: {type: 'integer', unsigned: true, nullable: false, defaultTo: 0},
437
- monthly_price_id: {type: 'string', maxlength: 24, nullable: true},
438
- yearly_price_id: {type: 'string', maxlength: 24, nullable: true},
439
438
  description: {type: 'string', maxlength: 191, nullable: true},
440
- type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'paid', validations: {isIn: [['paid', 'free']]}},
439
+ type: {
440
+ type: 'string',
441
+ maxlength: 50,
442
+ nullable: false,
443
+ defaultTo: 'paid',
444
+ validations: {
445
+ isIn: [['paid', 'free']]
446
+ }
447
+ },
448
+ currency: {type: 'string', maxlength: 50, nullable: true},
449
+ monthly_price: {type: 'integer', unsigned: true, nullable: true},
450
+ yearly_price: {type: 'integer', unsigned: true, nullable: true},
441
451
  created_at: {type: 'dateTime', nullable: false},
442
- updated_at: {type: 'dateTime', nullable: true}
452
+ updated_at: {type: 'dateTime', nullable: true},
453
+ // To be removed in future
454
+ monthly_price_id: {type: 'string', maxlength: 24, nullable: true},
455
+ yearly_price_id: {type: 'string', maxlength: 24, nullable: true}
443
456
  },
444
457
  offers: {
445
458
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
446
- // @deprecated: use a status enum with isIn validation, not aan ctive boolean
459
+ // @deprecated: use a status enum with isIn validation, not an `active` boolean
447
460
  active: {type: 'boolean', nullable: false, defaultTo: true},
448
461
  name: {type: 'string', maxlength: 191, nullable: false, unique: true},
449
462
  code: {type: 'string', maxlength: 191, nullable: false, unique: true},
@@ -516,7 +529,9 @@ module.exports = {
516
529
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
517
530
  member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
518
531
  amount: {type: 'integer', nullable: false},
519
- currency: {type: 'string', maxLength: 3, nullable: false},
532
+ // @note: this is longer than originally intended due to a bug - https://github.com/TryGhost/Ghost/pull/15606
533
+ // so we should decide whether we should reduce it down in the future
534
+ currency: {type: 'string', maxlength: 191, nullable: false},
520
535
  source: {type: 'string', maxlength: 50, nullable: false},
521
536
  created_at: {type: 'dateTime', nullable: false}
522
537
  },
@@ -565,7 +580,9 @@ module.exports = {
565
580
  subscription_id: {type: 'string', maxlength: 24, nullable: true},
566
581
  from_plan: {type: 'string', maxlength: 255, nullable: true},
567
582
  to_plan: {type: 'string', maxlength: 255, nullable: true},
568
- currency: {type: 'string', maxLength: 3, nullable: false},
583
+ // @note: this is longer than originally intended due to a bug - https://github.com/TryGhost/Ghost/pull/15606
584
+ // so we should decide whether we should reduce it down in the future
585
+ currency: {type: 'string', maxlength: 191, nullable: false},
569
586
  source: {
570
587
  type: 'string', maxlength: 50, nullable: false, validations: {
571
588
  isIn: [['stripe']]
@@ -600,13 +617,50 @@ module.exports = {
600
617
  updated_at: {type: 'dateTime', nullable: true},
601
618
  updated_by: {type: 'string', maxlength: 24, nullable: true}
602
619
  },
620
+ subscriptions: {
621
+ id: {type: 'string', maxlength: 24, nullable: false, primary: true},
622
+ type: {
623
+ type: 'string', maxlength: 50, nullable: false, validations: {
624
+ isIn: [['free', 'comped', 'paid']]
625
+ }
626
+ },
627
+ status: {
628
+ type: 'string', maxlength: 50, nullable: false, validations: {
629
+ isIn: [['active', 'expired', 'canceled']]
630
+ }
631
+ },
632
+ member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
633
+ tier_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'products.id'},
634
+
635
+ // These are null if type !== 'paid'
636
+ cadence: {
637
+ type: 'string', maxlength: 50, nullable: true, validations: {
638
+ isIn: [['month', 'year']]
639
+ }
640
+ },
641
+ currency: {type: 'string', maxlength: 50, nullable: true},
642
+ amount: {type: 'integer', nullable: true},
643
+
644
+ // e.g. 'stripe'
645
+ payment_provider: {type: 'string', maxlength: 50, nullable: true},
646
+ // e.g. Stripe Subscription Link
647
+ payment_subscription_url: {type: 'string', maxlength: 2000, nullable: true},
648
+ // e.g. Stripe Customer Link
649
+ payment_user_url: {type: 'string', maxlength: 2000, nullable: true},
650
+
651
+ offer_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'offers.id'},
652
+
653
+ expires_at: {type: 'dateTime', nullable: true},
654
+ created_at: {type: 'dateTime', nullable: false},
655
+ updated_at: {type: 'dateTime', nullable: true}
656
+ },
603
657
  members_stripe_customers_subscriptions: {
604
658
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
605
659
  customer_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'members_stripe_customers.customer_id', cascadeDelete: true},
606
660
  subscription_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
607
661
  stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: false, index: true, defaultTo: ''},
608
662
  status: {type: 'string', maxlength: 50, nullable: false},
609
- cancel_at_period_end: {type: 'bool', nullable: false, defaultTo: false},
663
+ cancel_at_period_end: {type: 'boolean', nullable: false, defaultTo: false},
610
664
  cancellation_reason: {type: 'string', maxlength: 500, nullable: true},
611
665
  current_period_end: {type: 'dateTime', nullable: false},
612
666
  start_date: {type: 'dateTime', nullable: false},
@@ -619,12 +673,14 @@ module.exports = {
619
673
  offer_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'offers.id'},
620
674
  trial_start_at: {type: 'dateTime', nullable: true},
621
675
  trial_end_at: {type: 'dateTime', nullable: true},
622
- /* Below fields are now redundant as we link prie_id to stripe_prices table */
676
+ /* Below fields are now redundant as we link stripe_price_id to stripe_prices table */
623
677
  plan_id: {type: 'string', maxlength: 255, nullable: false, unique: false},
624
678
  plan_nickname: {type: 'string', maxlength: 50, nullable: false},
625
679
  plan_interval: {type: 'string', maxlength: 50, nullable: false},
626
680
  plan_amount: {type: 'integer', nullable: false},
627
- plan_currency: {type: 'string', maxLength: 3, nullable: false}
681
+ // @note: this is longer than originally intended due to a bug - https://github.com/TryGhost/Ghost/pull/15606
682
+ // so we should decide whether we should reduce it down in the future
683
+ plan_currency: {type: 'string', maxlength: 191, nullable: false}
628
684
  },
629
685
  members_subscription_created_events: {
630
686
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
@@ -652,7 +708,7 @@ module.exports = {
652
708
  members_subscribe_events: {
653
709
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
654
710
  member_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'members.id', cascadeDelete: true},
655
- subscribed: {type: 'bool', nullable: false, defaultTo: true},
711
+ subscribed: {type: 'boolean', nullable: false, defaultTo: true},
656
712
  created_at: {type: 'dateTime', nullable: false},
657
713
  source: {
658
714
  type: 'string', maxlength: 50, nullable: true, validations: {
@@ -672,9 +728,11 @@ module.exports = {
672
728
  id: {type: 'string', maxlength: 24, nullable: false, primary: true},
673
729
  stripe_price_id: {type: 'string', maxlength: 255, nullable: false, unique: true},
674
730
  stripe_product_id: {type: 'string', maxlength: 255, nullable: false, unique: false, references: 'stripe_products.stripe_product_id'},
675
- active: {type: 'bool', nullable: false},
731
+ active: {type: 'boolean', nullable: false},
676
732
  nickname: {type: 'string', maxlength: 50, nullable: true},
677
- currency: {type: 'string', maxLength: 3, nullable: false},
733
+ // @note: this is longer than originally intended due to a bug - https://github.com/TryGhost/Ghost/pull/15606
734
+ // so we should decide whether we should reduce it down in the future
735
+ currency: {type: 'string', maxlength: 191, nullable: false},
678
736
  amount: {type: 'integer', nullable: false},
679
737
  type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'recurring', validations: {isIn: [['recurring', 'one_time']]}},
680
738
  interval: {type: 'string', maxlength: 50, nullable: true},
@@ -722,8 +780,8 @@ module.exports = {
722
780
  reply_to: {type: 'string', maxlength: 2000, nullable: true},
723
781
  html: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: true},
724
782
  plaintext: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: true},
725
- track_opens: {type: 'bool', nullable: false, defaultTo: false},
726
- track_clicks: {type: 'bool', nullable: false, defaultTo: false},
783
+ track_opens: {type: 'boolean', nullable: false, defaultTo: false},
784
+ track_clicks: {type: 'boolean', nullable: false, defaultTo: false},
727
785
  submitted_at: {type: 'dateTime', nullable: false},
728
786
  newsletter_id: {type: 'string', maxlength: 24, nullable: true, references: 'newsletters.id'},
729
787
  created_at: {type: 'dateTime', nullable: false},
@@ -850,5 +908,13 @@ module.exports = {
850
908
  member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
851
909
  redirect_id: {type: 'string', maxlength: 24, nullable: false, references: 'redirects.id', cascadeDelete: true},
852
910
  created_at: {type: 'dateTime', nullable: false}
911
+ },
912
+ members_feedback: {
913
+ id: {type: 'string', maxlength: 24, nullable: false, primary: true},
914
+ score: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0},
915
+ member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
916
+ post_id: {type: 'string', maxlength: 24, nullable: false, references: 'posts.id', cascadeDelete: true},
917
+ created_at: {type: 'dateTime', nullable: false},
918
+ updated_at: {type: 'dateTime', nullable: true}
853
919
  }
854
920
  };
@@ -63,7 +63,7 @@ function validateSchema(tableName, model, options) {
63
63
 
64
64
  // validate boolean columns
65
65
  if (Object.prototype.hasOwnProperty.call(schema[tableName][columnKey], 'type')
66
- && schema[tableName][columnKey].type === 'bool') {
66
+ && schema[tableName][columnKey].type === 'boolean') {
67
67
  if (!(validator.isBoolean(strVal) || validator.isEmpty(strVal))) {
68
68
  message = tpl(messages.valueMustBeBoolean, {
69
69
  tableName: tableName,