repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.25/2022-11-29-08-30-add-error-recipient-failures-table.js | ghost/core/core/server/data/migrations/versions/5.25/2022-11-29-08-30-add-error-recipient-failures-table.js | const utils = require('../../utils');
module.exports = utils.addTable('email_recipient_failures', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
email_id: {type: 'string', maxlength: 24, nullable: false, references: 'emails.id'},
member_id: {type: 'string', maxlength: 24, nullable: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.94/2024-09-03-20-09-40-null-analytics-jobs-timings.js | ghost/core/core/server/data/migrations/versions/5.94/2024-09-03-20-09-40-null-analytics-jobs-timings.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
// For DML - data changes
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
asyn... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.64/2023-09-19-04-25-40-truncate-stale-built-in-collections-posts.js | ghost/core/core/server/data/migrations/versions/5.64/2023-09-19-04-25-40-truncate-stale-built-in-collections-posts.js | const logging = require('@tryghost/logging');
module.exports = {
async up() {
logging.warn('Skipping migration - noop');
},
async down() {
logging.warn('Skipping migration - noop');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.64/2023-09-19-04-34-10-repopulate-built-in-collection-posts.js | ghost/core/core/server/data/migrations/versions/5.64/2023-09-19-04-34-10-repopulate-built-in-collection-posts.js | const logging = require('@tryghost/logging');
module.exports = {
async up() {
logging.warn('Skipping migration - noop');
},
async down() {
logging.warn('Skipping migration - noop');
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.32/2023-01-24-08-00-fix-invalid-tier-expiry-for-paid-members.js | ghost/core/core/server/data/migrations/versions/5.32/2023-01-24-08-00-fix-invalid-tier-expiry-for-paid-members.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Removing expiry dates for paid members');
try {
// Fetch all members with a paid status tha... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.32/2023-01-24-08-09-restore-incorrect-expired-tiers-for-members.js | ghost/core/core/server/data/migrations/versions/5.32/2023-01-24-08-09-restore-incorrect-expired-tiers-for-members.js | const logging = require('@tryghost/logging');
const ObjectId = require('bson-objectid').default;
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Restoring member<>tier mapping for members with paid status'... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-08-59-26-drop-newsletters-border-color-column.js | ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-08-59-26-drop-newsletters-border-color-column.js | const {createDropColumnMigration} = require('../../utils');
module.exports = createDropColumnMigration('newsletters', 'border_color', {
type: 'string',
maxlength: 50,
nullable: true
}); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-09-10-30-rename-newsletters-title-color-column.js | ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-09-10-30-rename-newsletters-title-color-column.js | const {createRenameColumnMigration} = require('../../utils');
module.exports = createRenameColumnMigration('newsletters', 'title_color', 'post_title_color'); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.121/2025-05-29-08-41-04-add-member-export-permissions-to-backup-integration.js | ghost/core/core/server/data/migrations/versions/5.121/2025-05-29-08-41-04-add-member-export-permissions-to-backup-integration.js | const {addPermissionToRole} = require('../../utils');
module.exports = addPermissionToRole({
permission: 'Browse Members',
role: 'DB Backup Integration'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-12-03-24-add-newsletters-color-columns.js | ghost/core/core/server/data/migrations/versions/5.121/2025-05-26-12-03-24-add-newsletters-color-columns.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('newsletters', 'header_background_color', {
type: 'string',
maxlength: 50,
nullable: false,
defaultTo: 'transpar... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-04-13-49-add-comments-table.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-04-13-49-add-comments-table.js | const {addTable} = require('../../utils');
module.exports = addTable('comments', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
post_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'posts.id', cascadeDelete: true},
member_id: {type: 'string', maxlengt... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-10-00-add-comment-related-fields-to-members.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-10-00-add-comment-related-fields-to-members.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('members', 'last_commented_at', {
type: 'dateTime',
nullable: true
}),
createAddColumnMigration('members', 'bio', {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-17-add-ghost-explore-integration.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-17-add-ghost-explore-integration.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating Ghost Explore Integra... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-13-add-ghost-explore-integration-role-permissions.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-13-add-ghost-explore-integration-role-permissions.js | const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'Read explore data',
action: 'read',
object: 'explore'
}, [
'Administrator',
'Admin Integration',
'Ghost Explore Integration'
]);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-15-35-add-comment-notifications-field-to-users-table.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-15-35-add-comment-notifications-field-to-users-table.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('users', 'comment_notifications', {
type: 'boolean',
nullable: false,
defaultTo: true
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-07-58-add-ghost-explore-integration-role.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-07-58-add-ghost-explore-integration-role.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating "Ghost Explore Integr... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-07-26-add-comments-enabled-setting.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-07-26-add-comments-enabled-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'comments_enabled',
value: 'off',
type: 'string',
group: 'comments'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-09-36-add-comments-likes-table.js | const {addTable} = require('../../utils');
module.exports = addTable('comment_likes', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: true},
member_id: {type: 'string... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-09-47-add-comments-reports-table.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-09-47-add-comments-reports-table.js | const {addTable} = require('../../utils');
module.exports = addTable('comment_reports', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
comment_id: {type: 'string', maxlength: 24, nullable: false, unique: false, references: 'comments.id', cascadeDelete: true},
member_id: {type: 'stri... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-12-55-add-comments-crud-permissions.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-05-12-55-add-comments-crud-permissions.js | const {combineTransactionalMigrations, addPermissionWithRoles} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionWithRoles({
name: 'Browse comments',
action: 'browse',
object: 'comment'
}, [
'Administrator',
'Admin Integration'
]... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-26-add-ghost-explore-integration-api-key.js | ghost/core/core/server/data/migrations/versions/5.3/2022-07-06-09-26-add-ghost-explore-integration-api-key.js | const {InternalServerError} = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const security = require('@tryghost/security');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = creat... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.93/2024-09-03-18-51-01-update-stripe-prices-nickname-length.js | ghost/core/core/server/data/migrations/versions/5.93/2024-09-03-18-51-01-update-stripe-prices-nickname-length.js | const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
const DatabaseInfo = require('@tryghost/database-info');
module.exports = createNonTransactionalMigration(
async function up(knex) {
if (DatabaseInfo.isSQLite(knex)) {
logging.warn('S... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.89/2024-07-30-19-51-06-backfill-offer-redemptions.js | ghost/core/core/server/data/migrations/versions/5.89/2024-07-30-19-51-06-backfill-offer-redemptions.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
const DatabaseInfo = require('@tryghost/database-info');
const {default: ObjectID} = require('bson-objectid');
// For DML - data changes
const {c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.81/2024-03-18-16-20-add-missing-post-permissions.js | ghost/core/core/server/data/migrations/versions/5.81/2024-03-18-16-20-add-missing-post-permissions.js | const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Edit posts',
role: 'Author'
}),
addPermissionToRole({
permission: 'Edit posts',
role: 'Contributor'
}... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.126/2025-06-12-14-18-57-add-mse-newsletter-created-index.js | ghost/core/core/server/data/migrations/versions/5.126/2025-06-12-14-18-57-add-mse-newsletter-created-index.js | const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
const {addIndex, dropIndex} = require('../../../schema/commands');
module.exports = createNonTransactionalMigration(
async function up(knex) {
await addIndex('members_subscribe_events', ['newslet... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.126/2025-06-18-11-35-41-change-newsletters-link-color-default-to-accent.js | ghost/core/core/server/data/migrations/versions/5.126/2025-06-18-11-35-41-change-newsletters-link-color-default-to-accent.js | const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
// newsletters.link_color was supposed to have a default value of 'accent' to match pre-emailCustomization behaviour
module.exports = createNonTransactionalMigration(
async function up(knex) {
lo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.126/2025-06-18-11-36-00-update-newsletters-link-color-null-to-accent.js | ghost/core/core/server/data/migrations/versions/5.126/2025-06-18-11-36-00-update-newsletters-link-color-null-to-accent.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
// newsletters.link_color was supposed to have a default value of 'accent' to match pre-emailCustomization behaviour
// this migration changes previous default of NULL to 'accent' for all existing newsletters s... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.126/2025-06-12-14-18-27-add-email-disabled-index.js | ghost/core/core/server/data/migrations/versions/5.126/2025-06-12-14-18-27-add-email-disabled-index.js | const {createAddIndexMigration} = require('../../utils');
module.exports = createAddIndexMigration('members', ['email_disabled']); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.76/2023-12-05-11-00-add-portal-default-plan-setting.js | ghost/core/core/server/data/migrations/versions/5.76/2023-12-05-11-00-add-portal-default-plan-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'portal_default_plan',
value: 'yearly',
type: 'string',
group: 'portal'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.54/2023-07-07-11-57-add-show-title-and-feature-image-column-to-posts.js | ghost/core/core/server/data/migrations/versions/5.54/2023-07-07-11-57-add-show-title-and-feature-image-column-to-posts.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('posts', 'show_title_and_feature_image', {
type: 'boolean',
nullable: false,
defaultTo: true
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.66/2023-09-22-14-15-add-recommendation-notifications-column.js | ghost/core/core/server/data/migrations/versions/5.66/2023-09-22-14-15-add-recommendation-notifications-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('users', 'recommendation_notifications', {
type: 'boolean',
nullable: false,
defaultTo: true
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.108/2025-01-23-02-51-10-add-blocked-email-domains-setting.js | ghost/core/core/server/data/migrations/versions/5.108/2025-01-23-02-51-10-add-blocked-email-domains-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'blocked_email_domains',
value: '[]',
type: 'array',
group: 'members'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.53/2023-06-13-12-24-add-temp-mail-events-table.js | ghost/core/core/server/data/migrations/versions/5.53/2023-06-13-12-24-add-temp-mail-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('temp_mail_events', {
id: {type: 'string', maxlength: 100, nullable: false, primary: true},
type: {type: 'string', maxlength: 50, nullable: false},
message_id: {type: 'string', maxlength: 150, nullable: false},
recipient: {type: 'stri... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.53/2023-06-20-10-19-add-collections-posts-table.js | ghost/core/core/server/data/migrations/versions/5.53/2023-06-20-10-19-add-collections-posts-table.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {addTable} = require('../../utils');
module.exports = addTable('collections_posts', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
collection_id: {type: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.53/2023-06-20-10-18-add-collections-table.js | ghost/core/core/server/data/migrations/versions/5.53/2023-06-20-10-18-add-collections-table.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {addTable} = require('../../utils');
module.exports = addTable('collections', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
title: {type: 'string', maxl... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.97/2024-10-08-14-36-58-added-heading-font-setting.js | ghost/core/core/server/data/migrations/versions/5.97/2024-10-08-14-36-58-added-heading-font-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'heading_font',
value: '',
type: 'string',
group: 'site'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.97/2024-10-09-14-04-10-add-session-verification-field.js | ghost/core/core/server/data/migrations/versions/5.97/2024-10-09-14-04-10-add-session-verification-field.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Adding verified property to sessions');
await knex.raw(`
UPDATE sessions
SET ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.97/2024-10-10-01-02-03-add-signin-urls-permissions.js | ghost/core/core/server/data/migrations/versions/5.97/2024-10-10-01-02-03-add-signin-urls-permissions.js | const {addPermissionToRole} = require('../../utils');
module.exports = addPermissionToRole({
permission: 'Read member signin urls',
role: 'Admin Integration'
}); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.97/2024-10-08-14-25-27-added-body-font-settings.js | ghost/core/core/server/data/migrations/versions/5.97/2024-10-08-14-25-27-added-body-font-settings.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'body_font',
value: '',
type: 'string',
group: 'site'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.87/2024-06-25-12-08-20-add-posts-tags-post-tag-index.js | ghost/core/core/server/data/migrations/versions/5.87/2024-06-25-12-08-20-add-posts-tags-post-tag-index.js | const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
const {addIndex, dropIndex} = require('../../../schema/commands');
module.exports = createNonTransactionalMigration(
async function up(knex) {
await addIndex('posts_tags', ['post_id', 'tag_id'], ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.87/2024-06-25-12-08-45-add-posts-type-status-updated-at-index.js | ghost/core/core/server/data/migrations/versions/5.87/2024-06-25-12-08-45-add-posts-type-status-updated-at-index.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {createAddIndexMigration} = require('../../utils');
module.exports = createAddIndexMigration('posts',['type','status','updated_at']); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.102/2024-12-02-17-48-40-add-index-redirects-from.js | ghost/core/core/server/data/migrations/versions/5.102/2024-12-02-17-48-40-add-index-redirects-from.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
const {addIndex, dropIndex} = require('../../../schema/commands');
const errors ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.102/2024-12-02-17-32-40-alter-length-redirects-from.js | ghost/core/core/server/data/migrations/versions/5.102/2024-12-02-17-32-40-alter-length-redirects-from.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
module.exports = createNonTransactionalMigration(
async function up(knex) {... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.111/2025-03-05-16-36-39-add-captcha-setting.js | ghost/core/core/server/data/migrations/versions/5.111/2025-03-05-16-36-39-add-captcha-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'captcha_enabled',
value: 'false',
type: 'boolean',
group: 'members'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.128/2025-06-26-09-36-41-add-social-web-setting.js | ghost/core/core/server/data/migrations/versions/5.128/2025-06-26-09-36-41-add-social-web-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'social_web',
value: 'true',
type: 'boolean',
group: 'social_web'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.28/2023-01-05-15-13-add-active-theme-permissions.js | ghost/core/core/server/data/migrations/versions/5.28/2023-01-05-15-13-add-active-theme-permissions.js | const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'View active theme details',
action: 'readActive',
object: 'theme'
}, [
'Author',
'Editor',
'Administrator',
'Admin Integration'
]);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.9/2022-08-09-08-32-added-new-integration-type.js | ghost/core/core/server/data/migrations/versions/5.9/2022-08-09-08-32-added-new-integration-type.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Changing Ghost Explore Integration to type "core"');
await knex('integrations')
.where({
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.114/2025-03-19-03-13-04-add-index-to-posts-uuid.js | ghost/core/core/server/data/migrations/versions/5.114/2025-03-19-03-13-04-add-index-to-posts-uuid.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {createAddIndexMigration} = require('../../utils');
module.exports = createAddIndexMigration('posts', ['uuid']);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.27/2022-12-13-16-15-add-usage-colums-to-tokens.js | ghost/core/core/server/data/migrations/versions/5.27/2022-12-13-16-15-add-usage-colums-to-tokens.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('tokens', 'updated_at', {
type: 'dateTime',
nullable: true
}),
createAddColumnMigration('tokens', 'first_used_at', {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.27/2023-01-04-04-13-add-suppressions-table.js | ghost/core/core/server/data/migrations/versions/5.27/2023-01-04-04-13-add-suppressions-table.js | const {addTable} = require('../../utils');
module.exports = addTable('suppressions', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
email: {type: 'string', maxlength: 191, nullable: false, unique: true},
email_id: {type: 'string', maxlength: 24, nullable: true, references: 'emails.i... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.27/2023-01-04-04-12-drop-suppressions-table.js | ghost/core/core/server/data/migrations/versions/5.27/2023-01-04-04-12-drop-suppressions-table.js | const {addTable} = require('../../utils');
const migration = addTable('suppressions', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
email_address: {type: 'string', maxlength: 191, nullable: false, unique: true},
email_id: {type: 'string', maxlength: 24, nullable: true, references: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.113/2025-03-07-12-24-00-add-super-editor.js | ghost/core/core/server/data/migrations/versions/5.113/2025-03-07-12-24-00-add-super-editor.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating "Super Editor" role')... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.113/2025-03-07-12-25-00-add-member-perms-to-super-editor.js | ghost/core/core/server/data/migrations/versions/5.113/2025-03-07-12-25-00-add-member-perms-to-super-editor.js | const {addPermissionToRole, combineTransactionalMigrations} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse Members',
role: 'Super Editor'
}),
addPermissionToRole({
permission: 'Read Members',
role: 'Super E... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.15/2022-09-12-16-10-add-posts-lexical-column.js | ghost/core/core/server/data/migrations/versions/5.15/2022-09-12-16-10-add-posts-lexical-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('posts', 'lexical', {
type: 'text',
maxlength: 1000000000,
fieldtype: 'long',
nullable: true
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.15/2022-09-16-08-22-add-post-revisions-table.js | ghost/core/core/server/data/migrations/versions/5.15/2022-09-16-08-22-add-post-revisions-table.js | const {addTable} = require('../../utils');
module.exports = addTable('post_revisions', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
post_id: {type: 'string', maxlength: 24, nullable: false, index: true},
lexical: {type: 'text', maxlength: 1000000000, fieldtype: 'long', nullable: t... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.15/2022-09-14-12-46-add-email-track-clicks-setting.js | ghost/core/core/server/data/migrations/versions/5.15/2022-09-14-12-46-add-email-track-clicks-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'email_track_clicks',
value: 'true',
type: 'boolean',
group: 'email'
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.56/2023-07-14-10-11-12-add-email-disabled-field-to-members.js | ghost/core/core/server/data/migrations/versions/5.56/2023-07-14-10-11-12-add-email-disabled-field-to-members.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('members', 'email_disabled', {
type: 'boolean',
nullable: false,
defaultTo: false
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.56/2023-07-15-10-11-12-update-members-email-disabled-field.js | ghost/core/core/server/data/migrations/versions/5.56/2023-07-15-10-11-12-update-members-email-disabled-field.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Setting email_disabled to true for all members that have their email on the suppression list');
await ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.29/2023-01-11-02-45-truncate-suppressions.js | ghost/core/core/server/data/migrations/versions/5.29/2023-01-11-02-45-truncate-suppressions.js | const logging = require('@tryghost/logging');
const {createNonTransactionalMigration} = require('../../utils');
module.exports = createNonTransactionalMigration(
async function up(knex) {
logging.info('Clearing suppressions table');
await knex('suppressions').truncate();
},
async function d... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.130/2025-07-11-14-14-54-add-explore-settings.js | ghost/core/core/server/data/migrations/versions/5.130/2025-07-11-14-14-54-add-explore-settings.js | const {combineTransactionalMigrations, addSetting} = require('../../utils');
module.exports = combineTransactionalMigrations(
addSetting({
key: 'explore_ping',
value: 'true',
type: 'boolean',
group: 'explore'
}),
addSetting({
key: 'explore_ping_growth',
value... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.63/2023-09-13-13-03-10-add-ghost-core-content-integration.js | ghost/core/core/server/data/migrations/versions/5.63/2023-09-13-13-03-10-add-ghost-core-content-integration.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
c... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.63/2023-09-13-13-34-11-add-ghost-core-content-integration-key.js | ghost/core/core/server/data/migrations/versions/5.63/2023-09-13-13-34-11-add-ghost-core-content-integration-key.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {InternalServerError} = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const security = require('@tryghost/security');
const {default: ObjectID} = require('bs... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.63/2023-09-12-11-22-11-add-recommendation-subscribe-events-table.js | ghost/core/core/server/data/migrations/versions/5.63/2023-09-12-11-22-11-add-recommendation-subscribe-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('recommendation_subscribe_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
recommendation_id: {type: 'string', maxlength: 24, nullable: false, references: 'recommendations.id', unique: false, cascadeDelete: true... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.63/2023-09-12-11-22-10-add-recommendation-click-events-table.js | ghost/core/core/server/data/migrations/versions/5.63/2023-09-12-11-22-10-add-recommendation-click-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('recommendation_click_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
recommendation_id: {type: 'string', maxlength: 24, nullable: false, references: 'recommendations.id', unique: false, cascadeDelete: true},
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js | ghost/core/core/server/data/migrations/versions/5.85/2024-06-10-14-53-31-add-posts-updated-at-index.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {createAddIndexMigration} = require('../../utils');
module.exports = createAddIndexMigration('posts',['updated_at']); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-52-add-self-serve-integration.js | ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-52-add-self-serve-integration.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating "Self-Serve Migration... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.40/2023-03-13-14-05-add-newsletter-show-latest-posts.js | ghost/core/core/server/data/migrations/versions/5.40/2023-03-13-14-05-add-newsletter-show-latest-posts.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('newsletters', 'show_latest_posts', {
type: 'boolean',
nullable: false,
defaultTo: false
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-19-02-add-self-serve-integration-api-key.js | ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-19-02-add-self-serve-integration-api-key.js | const {InternalServerError} = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const security = require('@tryghost/security');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = creat... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-42-add-self-serve-integration-role.js | ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-42-add-self-serve-integration-role.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const MIGRATION_USER = 1;
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating "Self-Serve Migration... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-43-add-self-serve-migration-and-permissions.js | ghost/core/core/server/data/migrations/versions/5.40/2023-03-21-18-43-add-self-serve-migration-and-permissions.js | const {combineTransactionalMigrations, addPermissionWithRoles} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionWithRoles({
name: 'Import database',
action: 'importContent',
object: 'db'
}, [
'Self-Serve Migration Integration'
]),
a... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.20/2022-10-19-11-17-add-link-browse-permissions.js | ghost/core/core/server/data/migrations/versions/5.20/2022-10-19-11-17-add-link-browse-permissions.js | const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'Browse links',
action: 'browse',
object: 'link'
}, [
'Administrator',
'Admin Integration'
]);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.20/2022-10-18-10-13-add-ghost-subscription-id-column-to-mscs.js | ghost/core/core/server/data/migrations/versions/5.20/2022-10-18-10-13-add-ghost-subscription-id-column-to-mscs.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('members_stripe_customers_subscriptions', 'ghost_subscription_id', {
type: 'string',
maxlength: 24,
nullable: true,
references: 'subscriptions.id',
constraintName: 'mscs_ghost_subscription_id_foreig... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.20/2022-10-20-02-52-add-link-edit-permissions.js | ghost/core/core/server/data/migrations/versions/5.20/2022-10-20-02-52-add-link-edit-permissions.js | const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'Edit links',
action: 'edit',
object: 'link'
}, [
'Administrator',
'Admin Integration'
]);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.20/2022-10-18-05-39-drop-nullable-tier-id.js | ghost/core/core/server/data/migrations/versions/5.20/2022-10-18-05-39-drop-nullable-tier-id.js | const {createDropNullableMigration} = require('../../utils');
module.exports = createDropNullableMigration('subscriptions', 'tier_id');
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.57/2023-07-27-11-47-49-create-donation-events.js | ghost/core/core/server/data/migrations/versions/5.57/2023-07-27-11-47-49-create-donation-events.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const {addTable} = require('../../utils');
module.exports = addTable('donation_payment_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
name: {type: 'st... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.57/2023-07-26-12-44-stripe-products-nullable-product.js | ghost/core/core/server/data/migrations/versions/5.57/2023-07-26-12-44-stripe-products-nullable-product.js | const {createSetNullableMigration} = require('../../utils');
// We need to disable foreign key checks because if MySQL is missing the STRICT_TRANS_TABLES mode, we cannot revert the migration
module.exports = createSetNullableMigration('stripe_products', 'product_id', {disableForeignKeyChecks: true});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-16-49-set-track-clicks-based-on-opens.js | ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-16-49-set-track-clicks-based-on-opens.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
// Set email_track_clicks to the current value of email_track_opens
module.exports = createTransactionalMigration(
async function up(connection) {
const reuseValueOfSetting = await connection('setti... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-55-add-redirects-table.js | ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-55-add-redirects-table.js | const {addTable} = require('../../utils');
module.exports = addTable('redirects', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
from: {type: 'string', maxlength: 2000, nullable: false},
to: {type: 'string', maxlength: 2000, nullable: false},
post_id: {type: 'string', maxlength:... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-53-remove-click-tracking-tables.js | ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-53-remove-click-tracking-tables.js | const {addTable, combineNonTransactionalMigrations} = require('../../utils');
function reverseMigration({up, down, config}) {
return {
config,
up: down,
down: up
};
}
module.exports = reverseMigration(
combineNonTransactionalMigrations(
addTable('link_redirects', {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.17/2022-09-29-12-39-add-track-clicks-column-to-emails.js | ghost/core/core/server/data/migrations/versions/5.17/2022-09-29-12-39-add-track-clicks-column-to-emails.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('emails', 'track_clicks', {
type: 'boolean',
nullable: false,
defaultTo: false
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-56-add-members-click-events-table.js | ghost/core/core/server/data/migrations/versions/5.17/2022-09-27-13-56-add-members-click-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('members_click_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
redirect_id: {type: 'string', maxle... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.90/2024-08-20-09-40-24-update-default-donations-suggested-amount.js | ghost/core/core/server/data/migrations/versions/5.90/2024-08-20-09-40-24-update-default-donations-suggested-amount.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
// For DDL - schema changes
// const {createNonTransactionalMigration} = require('../../utils');
// For DML - data changes
const {createTransact... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-11-12-08-drop-webhooks-status-column.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-11-12-08-drop-webhooks-status-column.js | const {createDropColumnMigration} = require('../../utils');
// Preferably I could use `createIrreversibleMigration` here like
// `createIrreversibleMigration(createDropColumnMigration(...).up)` but
// that seems to throw some obscure error that I'm not sure about... something
// to look into for the future
module.expo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-04-26-15-44-backfill-mrr-events-for-canceled-subscriptions.js | ghost/core/core/server/data/migrations/versions/5.0/2022-04-26-15-44-backfill-mrr-events-for-canceled-subscriptions.js | const ObjectID = require('bson-objectid').default;
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
// eslint-disable-next-line no-restricted-syntax
const canceledSu... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-15-17-drop-oauth-table.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-15-17-drop-oauth-table.js | const {dropTables} = require('../../utils');
module.exports = dropTables(['oauth']); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-11-13-12-rename-settings.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-11-13-12-rename-settings.js | const logging = require('@tryghost/logging');
const _ = require('lodash');
const {createTransactionalMigration} = require('../../utils');
const renameMappings = [{
from: 'lang',
to: 'locale'
}, {
from: 'session_secret',
to: 'admin_session_secret'
}];
module.exports = createTransactionalMigration(
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-04-25-10-32-backfill-mrr-for-discounted-subscriptions.js | ghost/core/core/server/data/migrations/versions/5.0/2022-04-25-10-32-backfill-mrr-for-discounted-subscriptions.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
const subscriptionsToUpdate = await knex('members_stripe_customers_subscriptions AS s')
.join('offers AS o', 's.... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-13-29-add-newsletters-admin-integration-permission-roles.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-13-29-add-newsletters-admin-integration-permission-roles.js | const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse newsletters',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Read newsletters',
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-21-00-00-regenerate-posts-html.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-21-00-00-regenerate-posts-html.js | const logging = require('@tryghost/logging');
const {createIrreversibleMigration} = require('../../utils');
const mobiledocLib = require('../../../../lib/mobiledoc');
const htmlToPlaintext = require('@tryghost/html-to-plaintext');
module.exports = createIrreversibleMigration(async (knex) => {
logging.info(`Startin... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-10-14-57-cleanup-invalid-posts-status.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-10-14-57-cleanup-invalid-posts-status.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info(`Updating posts with invalid statuses to 'draft'`);
const affectedRows = await knex('posts')
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-04-28-03-26-remove-author-id-column-from-posts-table.js | ghost/core/core/server/data/migrations/versions/5.0/2022-04-28-03-26-remove-author-id-column-from-posts-table.js | const {createDropColumnMigration} = require('../../utils');
module.exports = createDropColumnMigration('posts', 'author_id', {});
module.exports.down = async () => {
// noop - major version migrations are not backwards compatible
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-03-28-15-25-backfill-mrr-adjustments-for-offers.js | ghost/core/core/server/data/migrations/versions/5.0/2022-03-28-15-25-backfill-mrr-adjustments-for-offers.js | const logging = require('@tryghost/logging');
const {uniq} = require('lodash');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Adjusting MRR based on Offer Redemptions');
const offerRedemptions =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-12-13-51-add-label-permissions-for-authors.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-12-13-51-add-label-permissions-for-authors.js | const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse labels',
role: 'Author'
}),
addPermissionToRole({
permission: 'Read labels',
role: 'Author'
})... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-10-08-33-drop-members-analytics-table.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-10-08-33-drop-members-analytics-table.js | const {dropTables} = require('../../utils');
module.exports = dropTables(['temp_member_analytic_events']); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-06-13-22-add-frontend-integration.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-06-13-22-add-frontend-integration.js | const logging = require('@tryghost/logging');
const ObjectID = require('bson-objectid').default;
const security = require('@tryghost/security');
const {createTransactionalMigration} = require('../../utils');
const frontendIntegration = {
slug: 'ghost-internal-frontend',
name: 'Ghost Internal Frontend',
des... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-03-14-12-33-delete-duplicate-offer-redemptions.js | ghost/core/core/server/data/migrations/versions/5.0/2022-03-14-12-33-delete-duplicate-offer-redemptions.js | const DatabaseInfo = require('@tryghost/database-info');
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
if (DatabaseInfo.isSQLite(knex)) {
const duplicates = a... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-03-09-39-drop-nullable-subscribe-event-newsletter-id.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-03-09-39-drop-nullable-subscribe-event-newsletter-id.js | const {createDropNullableMigration} = require('../../utils');
// We need to disable foreign key checks because if MySQL is missing the STRICT_TRANS_TABLES mode, we cannot drop nullable from a foreign key
module.exports = createDropNullableMigration('members_subscribe_events', 'newsletter_id', {disableForeignKeyChecks:... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-12-10-29-add-newsletter-permissions-for-editors-and-authors.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-12-10-29-add-newsletter-permissions-for-editors-and-authors.js | const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse newsletters',
role: 'Editor'
}),
addPermissionToRole({
permission: 'Read newsletters',
role: 'Edit... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-13-11-38-drop-none-email-recipient-filter.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-13-11-38-drop-none-email-recipient-filter.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
// The 'none' value is no longer supported/used
logging.info(`Updating posts with email_recipient_filter 'none' to 'a... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-13-13-migrate-legacy-recipient-filters.js | ghost/core/core/server/data/migrations/versions/5.0/2022-05-05-13-13-migrate-legacy-recipient-filters.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(transaction) {
const postsFreeCount = await transaction('posts')
.where('email_recipient_filter', 'free')
.up... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.