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/api/endpoints/utils/validators/input/media.js | ghost/core/core/server/api/endpoints/utils/validators/input/media.js | const limitService = require('../../../../../services/limits');
module.exports = {
async upload(apiConfig, frame) {
await limitService.errorIfIsOverLimit('uploads', {currentCount: frame.file.size});
},
async uploadThumbnail(apiConfig, frame) {
await limitService.errorIfIsOverLimit('uploads... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/snippets.js | ghost/core/core/server/api/endpoints/utils/validators/input/snippets.js | const jsonSchema = require('../utils/json-schema');
module.exports = {
add: jsonSchema.validate,
edit: jsonSchema.validate
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/files.js | ghost/core/core/server/api/endpoints/utils/validators/input/files.js | const limitService = require('../../../../../services/limits');
module.exports = {
async upload(apiConfig, frame) {
await limitService.errorIfIsOverLimit('uploads', {currentCount: frame.file.size});
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/input/automated_emails.js | ghost/core/core/server/api/endpoints/utils/validators/input/automated_emails.js | // Filename must match the docName specified in ../../../automated-emails.js
/* eslint-disable ghost/filenames/match-regex */
const {ValidationError} = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const ALLOWED_STATUSES = ['inactive', 'active'];
const ALLOWED_NAMES = ['Welcome Email (Free)', 'We... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/api/endpoints/utils/validators/output/index.js | ghost/core/core/server/api/endpoints/utils/validators/output/index.js | module.exports = {};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/index.js | ghost/core/core/server/adapters/storage/index.js | const adapterManager = require('../../services/adapter-manager');
/**
* @param {'images'|'media'|'files'} [feature] - name for the "feature" to enable through adapter, e.g.: images or media storage
* @returns {Object} adapter instance
*/
function getStorage(feature) {
let adapterName = 'storage';
if (featu... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/LocalMediaStorage.js | ghost/core/core/server/adapters/storage/LocalMediaStorage.js | // # Local File System Media Storage module
// The (default) module for storing media, using the local file system
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const LocalStorageBase = require('./LocalStorageBase');
const messages = {
notFound: 'Media fil... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/LocalFilesStorage.js | ghost/core/core/server/adapters/storage/LocalFilesStorage.js | // # Local File System Storage module
// The (default) module for storing media, using the local file system
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const LocalStorageBase = require('./LocalStorageBase');
const messages = {
notFound: 'File not found'... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/LocalStorageBase.js | ghost/core/core/server/adapters/storage/LocalStorageBase.js | // # Local File Base Storage module
// The (default) module for storing files using the local file system
const serveStatic = require('../../../shared/express').static;
const fs = require('fs-extra');
const path = require('path');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/LocalImagesStorage.js | ghost/core/core/server/adapters/storage/LocalImagesStorage.js | // # Local File System Image Storage module
// The (default) module for storing images, using the local file system
const config = require('../../../shared/config');
const urlUtils = require('../../../shared/url-utils');
const LocalStorageBase = require('./LocalStorageBase');
let messages = {
notFound: 'Image not ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/storage/utils.js | ghost/core/core/server/adapters/storage/utils.js | const urlUtils = require('../../../shared/url-utils');
/**
* @TODO: move `events.js` to here - e.g. storageUtils.getStorage
*/
/**
* Sanitizes a given URL or path for an image to be readable by the local file storage
* as storage needs the path without `/content/images/` prefix
* Always returns {string} url
* @p... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/index.js | ghost/core/core/server/adapters/scheduling/index.js | const postScheduling = require('./post-scheduling');
/**
* @description Initialize all scheduler modules.
*
* We currently only support post-scheduling: publish posts/pages when scheduled.
*
* @param {Object} options
* @param {string} options.apiUrl - Target Ghost API url
*/
exports.init = function init(options... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/scheduling-base.js | ghost/core/core/server/adapters/scheduling/scheduling-base.js | function SchedulingBase() {
Object.defineProperty(this, 'requiredFns', {
value: ['schedule', 'unschedule', 'run'],
writable: false
});
}
module.exports = SchedulingBase;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/scheduling-default.js | ghost/core/core/server/adapters/scheduling/scheduling-default.js | const util = require('util');
const moment = require('moment');
const debug = require('@tryghost/debug')('scheduling-default');
const SchedulingBase = require('./scheduling-base');
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const request = require('@tryghost/request');
/*... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/utils.js | ghost/core/core/server/adapters/scheduling/utils.js | const adapterManager = require('../../services/adapter-manager');
async function createAdapter() {
return adapterManager.getAdapter('scheduling');
}
module.exports = {
createAdapter
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/post-scheduling/scheduling-auth-token.js | ghost/core/core/server/adapters/scheduling/post-scheduling/scheduling-auth-token.js | const moment = require('moment');
const jwt = require('jsonwebtoken');
/**
* @description Get signed admin token for making authenticated scheduling requests
*
* @param {Object} options
* @param {string} options.publishedAt - ISO date
* @param {string} options.apiUrl - url of the JWT's audience
* @param {string}... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/post-scheduling/index.js | ghost/core/core/server/adapters/scheduling/post-scheduling/index.js | const events = require('../../../lib/common/events');
const localUtils = require('../utils');
const PostScheduler = require('./PostScheduler');
const getSchedulerIntegration = require('./scheduler-intergation');
const {sequence} = require('@tryghost/promise');
/**
* @description Load all scheduled posts/pages from da... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/post-scheduling/PostScheduler.js | ghost/core/core/server/adapters/scheduling/post-scheduling/PostScheduler.js | const moment = require('moment');
const errors = require('@tryghost/errors');
const urlUtils = require('../../../../shared/url-utils');
const getSignedAdminToken = require('./scheduling-auth-token');
class PostScheduler {
constructor({apiUrl, integration, adapter, scheduledResources, events} = {}) {
if (!... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js | ghost/core/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js | const models = require('../../../models');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const messages = {
resourceNotFound: '{resource} not found.'
};
/**
* @description Load the internal scheduler integration
*
* @return {Promise}
*/
const getSchedulerIntegration = funct... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/cache/MemoryCache.js | ghost/core/core/server/adapters/cache/MemoryCache.js | const Base = require('@tryghost/adapter-base-cache');
class MemoryCache extends Base {
constructor() {
super();
this._data = {};
}
get(key) {
return this._data[key];
}
/**
*
* @param {String} key
* @param {*} value
*/
set(key, value) {
this... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/cache/memory-ttl.js | ghost/core/core/server/adapters/cache/memory-ttl.js | const TTLMemoryCache = require('./AdapterCacheMemoryTTL');
module.exports = TTLMemoryCache;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/cache/index.js | ghost/core/core/server/adapters/cache/index.js | const adapterManager = require('../../services/adapter-manager');
/**
* @param {'settings'|'theme'|'urls'} [feature] - name for the "feature" to enable through adapter, e.g.: settings cache
* @returns {Object} cache adapter instance
*/
function getCache(feature) {
let adapterName = 'cache';
if (feature) {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js | ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js | const TTLCache = require('@isaacs/ttlcache');
const Base = require('@tryghost/adapter-base-cache');
/**
* Cache adapter compatible wrapper around TTLCache
* Distinct features of this cache adapter:
* - it is in-memory only
* - it supports time-to-live (TTL)
* - it supports a max number of items
*/
class AdapterC... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/cache/Redis.js | ghost/core/core/server/adapters/cache/Redis.js | /* eslint-disable ghost/filenames/match-regex */
const RedisCache = require('../lib/redis/AdapterCacheRedis');
module.exports = RedisCache;
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/lib/redis/redis-store-factory.js | ghost/core/core/server/adapters/lib/redis/redis-store-factory.js | const defaultCacheManager = require('cache-manager-ioredis');
let redisStoreSingletonInstance;
/**
*
* @param {object} [storeOptions] options to pass to the Redis store instance
* @param {boolean} [reuseConnection] specifies if the Redis store/connection should be reused within the process
* @param {object} [CacheM... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js | ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js | const BaseCacheAdapter = require('@tryghost/adapter-base-cache');
const logging = require('@tryghost/logging');
const metrics = require('@tryghost/metrics');
const debug = require('@tryghost/debug')('redis-cache');
const cacheManager = require('cache-manager');
const redisStoreFactory = require('./redis-store-factory')... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/sso/SSOBase.js | ghost/core/core/server/adapters/sso/SSOBase.js | module.exports = class SSOBase {
constructor() {
Object.defineProperty(this, 'requiredFns', {
value: ['getRequestCredentials', 'getIdentityFromCredentials', 'getUserForIdentity'],
writable: false
});
}
};
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/adapters/sso/DefaultSSOAdapter.js | ghost/core/core/server/adapters/sso/DefaultSSOAdapter.js | const Base = require('./SSOBase');
module.exports = class DefaultSSOAdapter extends Base {
constructor() {
super();
}
async getRequestCredentials() {
return null;
}
async getIdentityFromCredentials() {
return null;
}
async getUserForIdentity() {
return nul... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/validate-password.js | ghost/core/core/server/lib/validate-password.js | const _ = require('lodash');
const validator = require('@tryghost/validator');
const tpl = require('@tryghost/tpl');
const settingsCache = require('../../shared/settings-cache');
const urlUtils = require('../../shared/url-utils');
const messages = {
passwordDoesNotComplyLength: 'Your password must be at least {m... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/lexical.js | ghost/core/core/server/lib/lexical.js | const path = require('path');
const errors = require('@tryghost/errors');
const urlUtils = require('../../shared/url-utils');
const config = require('../../shared/config');
const labs = require('../../shared/labs');
const storage = require('../adapters/storage');
let nodes;
let lexicalHtmlRenderer;
let customNodeRende... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/request-external.js | ghost/core/core/server/lib/request-external.js | /**
* @typedef {import('got').Got} Got
* @typedef {import('got').ExtendOptions} ExtendOptions
*/
const got = /** @type {Got} */ (/** @type {unknown} */ (require('got')));
const dnsPromises = require('dns').promises;
const errors = require('@tryghost/errors');
const config = require('../../shared/config');
const val... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/bootstrap-socket.js | ghost/core/core/server/lib/bootstrap-socket.js | const logging = require('@tryghost/logging');
module.exports.connectAndSend = (socketAddress, message) => {
// Very basic guard against bad calls
if (!socketAddress || !socketAddress.host || !socketAddress.port || !logging || !logging.info || !logging.warn || !message) {
return Promise.resolve();
}... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/mobiledoc.js | ghost/core/core/server/lib/mobiledoc.js | const path = require('path');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const config = require('../../shared/config');
const storage = require('../adapters/storage');
let cardFactory;
let cards;
let mobiledocHtmlRenderer;
module.exports = {
get blankDocument() {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/package-json/index.js | ghost/core/core/server/lib/package-json/index.js | module.exports = require('./package-json'); | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/package-json/parse.js | ghost/core/core/server/lib/package-json/parse.js | const fs = require('fs-extra');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
couldNotReadPackage: 'Could not read package.json file',
nameOrVersionMissing: '"name" or "version" is missing from theme package.json file.',
willBeRequired: 'This will be r... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/package-json/package-json.js | ghost/core/core/server/lib/package-json/package-json.js | /*
* # Package Utils
*
* Ghost has support for several different types of sub-packages:
* - Themes: have always been packages, but we're going to lean more heavily on npm & package.json in future
* - Adapters: replace fundamental pieces like storage, will become npm modules
*
* These utils facilitate loading, re... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/ImageUtils.js | ghost/core/core/server/lib/image/ImageUtils.js | const BlogIcon = require('./BlogIcon');
const CachedImageSizeFromUrl = require('./CachedImageSizeFromUrl');
const Gravatar = require('./Gravatar');
const ImageSize = require('./ImageSize');
const probe = require('probe-image-size');
class ImageUtils {
constructor({config, urlUtils, settingsCache, storageUtils, sto... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/index.js | ghost/core/core/server/lib/image/index.js | const request = require('@tryghost/request');
const urlUtils = require('../../../shared/url-utils');
const storage = require('../../adapters/storage');
const storageUtils = require('../../adapters/storage/utils');
const validator = require('@tryghost/validator');
const config = require('../../../shared/config');
const ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/BlogIcon.js | ghost/core/core/server/lib/image/BlogIcon.js | const sizeOf = require('image-size');
const _ = require('lodash');
const path = require('path');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
error: 'Could not fetch icon dimensions.'
};
class BlogIcon {
constructor({config, urlUtils, settingsCache, stor... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/CachedImageSizeFromUrl.js | ghost/core/core/server/lib/image/CachedImageSizeFromUrl.js | const debug = require('@tryghost/debug')('utils:image-size-cache');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
/**
* @example
* {
* height: 50,
* url: 'https://mysite.com/images/cat.jpg',
* width: 50
* }
* @typedef ImageSizeCache
* @type {Object}
* @propert... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/ImageSize.js | ghost/core/core/server/lib/image/ImageSize.js | const debug = require('@tryghost/debug')('utils:image-size');
const sizeOf = require('image-size');
const url = require('url');
const path = require('path');
const _ = require('lodash');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const messages = {
invalidDimensions: 'Could ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/image/Gravatar.js | ghost/core/core/server/lib/image/Gravatar.js | const crypto = require('crypto');
const tpl = require('@tryghost/tpl');
class Gravatar {
constructor({config, request}) {
this.config = config;
this.request = request;
}
url(email, options) {
if (options.default) {
// tpl errors on token `{default}` so we use `{_default... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/lib/common/events.js | ghost/core/core/server/lib/common/events.js | /**
* Why has this not been moved to e.g. @tryghost/events or shared yet?
*
* - We currently massively overuse this utility, coupling together bits of the codebase in unexpected ways
* - We want to prevent this, not reinforce it
* * Having an @tryghost/events or shared/events module would reinforce this bad patter... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/db/info.js | ghost/core/core/server/data/db/info.js | const connection = require('./connection');
const DatabaseInfo = require('@tryghost/database-info');
module.exports = new DatabaseInfo(connection);
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/db/index.js | ghost/core/core/server/data/db/index.js | /** @type {import('knex').Knex} */
let connection;
Object.defineProperty(exports, 'knex', {
enumerable: true,
configurable: true,
get: function get() {
connection = connection || require('./connection');
return connection;
}
});
| javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/db/DatabaseStateManager.js | ghost/core/core/server/data/db/DatabaseStateManager.js | const KnexMigrator = require('knex-migrator');
const errors = require('@tryghost/errors');
const logging = require('@tryghost/logging');
const metrics = require('@tryghost/metrics');
const sentry = require('../../../shared/sentry');
const states = {
READY: 0,
NEEDS_INITIALISATION: 1,
NEEDS_MIGRATION: 2,
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/db/backup.js | ghost/core/core/server/data/db/backup.js | // # Backup Database
// Provides for backing up the database before making potentially destructive changes
const fs = require('fs-extra');
const path = require('path');
const config = require('../../../shared/config');
const logging = require('@tryghost/logging');
const urlUtils = require('../../../shared/url-utils');... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/ghost/core/core/server/data/db/connection.js | ghost/core/core/server/data/db/connection.js | const _ = require('lodash');
const knex = require('knex');
const os = require('os');
const fs = require('fs');
const logging = require('@tryghost/logging');
const config = require('../../../shared/config');
const errors = require('@tryghost/errors');
/** @type {knex.Knex} */
let knexInstance;
// @TODO:
// - if you r... | 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/hooks/migrate/index.js | ghost/core/core/server/data/migrations/hooks/migrate/index.js | exports.before = require('./before');
exports.beforeEach = require('./beforeEach');
exports.afterEach = require('./afterEach');
exports.shutdown = require('./shutdown');
| 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/hooks/migrate/afterEach.js | ghost/core/core/server/data/migrations/hooks/migrate/afterEach.js | /* eslint-disable ghost/filenames/match-regex */
module.exports = function afterEach() {
return Promise.resolve();
};
| 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/hooks/migrate/shutdown.js | ghost/core/core/server/data/migrations/hooks/migrate/shutdown.js | const database = require('../../../db');
module.exports = function shutdown(options = {}) {
/**
* We have to close Ghost's db connection if knex-migrator was used in the shell.
* Otherwise the process doesn't exit.
*/
if (options.executedFromShell === true) {
return database.knex.destroy... | 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/hooks/migrate/before.js | ghost/core/core/server/data/migrations/hooks/migrate/before.js | const dbBackup = require('../../../db/backup');
const models = require('../../../../models');
module.exports = function before() {
models.init();
return dbBackup.backup();
};
| 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/hooks/migrate/beforeEach.js | ghost/core/core/server/data/migrations/hooks/migrate/beforeEach.js | /* eslint-disable ghost/filenames/match-regex */
module.exports = function beforeEach() {
return Promise.resolve();
};
| 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/hooks/init/index.js | ghost/core/core/server/data/migrations/hooks/init/index.js | exports.shutdown = require('./shutdown');
exports.before = require('./before');
| 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/hooks/init/shutdown.js | ghost/core/core/server/data/migrations/hooks/init/shutdown.js | const _ = require('lodash');
const database = require('../../../db');
module.exports = function shutdown(options = {}) {
if (options.executedFromShell === true) {
// running knex-migrator migrate --init in the shell does two different migration calls within a single process
// we have to ensure 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/hooks/init/before.js | ghost/core/core/server/data/migrations/hooks/init/before.js | const models = require('../../../../models');
module.exports = function before() {
models.init();
return Promise.resolve();
};
| 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/utils/migrations.js | ghost/core/core/server/data/migrations/utils/migrations.js | const errors = require('@tryghost/errors');
/**
* @param {(connection: import('knex').Knex) => Promise<void>} up
* @param {(connection: import('knex').Knex) => Promise<void>} down
*
* @returns {Migration}
*/
function createNonTransactionalMigration(up, down) {
return {
config: {
transactio... | 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/utils/index.js | ghost/core/core/server/data/migrations/utils/index.js | module.exports = {
...require('./migrations'),
...require('./permissions'),
...require('./schema'),
...require('./settings'),
...require('./tables')
};
| 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/utils/tables.js | ghost/core/core/server/data/migrations/utils/tables.js | const logging = require('@tryghost/logging');
const {commands} = require('../../schema');
const {createIrreversibleMigration, createNonTransactionalMigration} = require('./migrations');
/**
* Creates a migrations which will add a new table from schema.js to the database
* @param {string} name - table name
* @param ... | 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/utils/schema.js | ghost/core/core/server/data/migrations/utils/schema.js | const logging = require('@tryghost/logging');
const {commands} = require('../../schema');
const DatabaseInfo = require('@tryghost/database-info');
const {createNonTransactionalMigration, createTransactionalMigration} = require('./migrations');
/**
* @param {string} table
* @param {string} column
* @param {Object} ... | 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/utils/permissions.js | ghost/core/core/server/data/migrations/utils/permissions.js | const ObjectId = require('bson-objectid').default;
const logging = require('@tryghost/logging');
const errors = require('@tryghost/errors');
const tpl = require('@tryghost/tpl');
const {createTransactionalMigration, combineTransactionalMigrations} = require('./migrations');
const MIGRATION_USER = 1;
const messages = ... | 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/utils/settings.js | ghost/core/core/server/data/migrations/utils/settings.js | const ObjectId = require('bson-objectid').default;
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('./migrations');
const MIGRATION_USER = 1;
/**
* Creates a migration which will insert a new setting in settings table
* @param {object} settingSpec - setting type and grou... | 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/init/2-create-fixtures.js | ghost/core/core/server/data/migrations/init/2-create-fixtures.js | const {fixtureManager} = require('../../schema/fixtures');
module.exports.config = {
transaction: true
};
module.exports.up = async function insertFixtures(options) {
return await fixtureManager.addAllFixtures(options);
};
| 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/init/1-create-tables.js | ghost/core/core/server/data/migrations/init/1-create-tables.js | const commands = require('../../schema').commands;
const schema = require('../../schema').tables;
const logging = require('@tryghost/logging');
const schemaTables = Object.keys(schema);
const {sequence} = require('@tryghost/promise');
module.exports.up = async (options) => {
const connection = options.connection;
... | 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.39/2023-03-13-09-29-add-newsletter-show-post-title-section.js | ghost/core/core/server/data/migrations/versions/5.39/2023-03-13-09-29-add-newsletter-show-post-title-section.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('newsletters', 'show_post_title_section', {
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.39/2023-03-14-12-26-add-last-mentions-email-report-timestamp-setting.js | ghost/core/core/server/data/migrations/versions/5.39/2023-03-14-12-26-add-last-mentions-email-report-timestamp-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'last_mentions_report_email_timestamp',
value: null,
type: 'number',
group: 'core'
});
| 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.39/2023-03-13-14-30-add-newsletter-show-subscription-details.js | ghost/core/core/server/data/migrations/versions/5.39/2023-03-13-14-30-add-newsletter-show-subscription-details.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('newsletters', 'show_subscription_details', {
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.39/2023-03-13-13-11-add-newsletter-show-comment-cta.js | ghost/core/core/server/data/migrations/versions/5.39/2023-03-13-13-11-add-newsletter-show-comment-cta.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('newsletters', 'show_comment_cta', {
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.44/2023-04-14-04-17-add-snippets-lexical-column.js | ghost/core/core/server/data/migrations/versions/5.44/2023-04-14-04-17-add-snippets-lexical-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('snippets', '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.79/2024-01-30-19-36-44-fix-discrepancy-in-free-tier-visibility.js | ghost/core/core/server/data/migrations/versions/5.79/2024-01-30-19-36-44-fix-discrepancy-in-free-tier-visibility.js | const {createTransactionalMigration} = require('../../utils');
const logging = require('@tryghost/logging');
module.exports = createTransactionalMigration(
async function up(knex) {
const portalPlansRaw = await knex('settings').select('value').where('key', 'portal_plans').first();
const freeTier = ... | 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.117/2025-04-14-02-36-30-add-additional-social-accounts-columns-to-user-table.js | ghost/core/core/server/data/migrations/versions/5.117/2025-04-14-02-36-30-add-additional-social-accounts-columns-to-user-table.js | const {combineNonTransactionalMigrations, createAddColumnMigration} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('users', 'threads', {
type: 'string',
maxlength: 191,
nullable: true
}),
createAddColumnMigration('users', 'blues... | 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.34/2023-02-08-03-08-add-mentions-notifications-column.js | ghost/core/core/server/data/migrations/versions/5.34/2023-02-08-03-08-add-mentions-notifications-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('users', 'mention_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.34/2023-01-30-07-27-add-mentions-permission.js | ghost/core/core/server/data/migrations/versions/5.34/2023-01-30-07-27-add-mentions-permission.js | const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'Browse mentions',
action: 'browse',
object: 'mention'
}, [
'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.34/2023-02-08-22-32-add-mentions-delete-column.js | ghost/core/core/server/data/migrations/versions/5.34/2023-02-08-22-32-add-mentions-delete-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('mentions', 'deleted', {
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/4.47/2022-05-04-10-03-no-op.js | ghost/core/core/server/data/migrations/versions/4.47/2022-05-04-10-03-no-op.js | const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up() {},
async function down() {}
); | 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/4.47/2022-05-03-15-30-final-v4.js | ghost/core/core/server/data/migrations/versions/4.47/2022-05-03-15-30-final-v4.js | const {createFinalMigration} = require('../../utils');
module.exports = createFinalMigration(4);
| 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.16/2022-09-19-09-04-add-link-redirects-table.js | ghost/core/core/server/data/migrations/versions/5.16/2022-09-19-09-04-add-link-redirects-table.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.16/2022-09-19-09-05-add-members-link-click-events-table.js | ghost/core/core/server/data/migrations/versions/5.16/2022-09-19-09-05-add-members-link-click-events-table.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.16/2022-09-19-17-44-add-referrer-columns-to-subscription-events-table.js | ghost/core/core/server/data/migrations/versions/5.16/2022-09-19-17-44-add-referrer-columns-to-subscription-events-table.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('members_subscription_created_events', 'referrer_source', {
type: 'string',
maxlength: 191,
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.16/2022-09-19-17-44-add-referrer-columns-to-member-events-table.js | ghost/core/core/server/data/migrations/versions/5.16/2022-09-19-17-44-add-referrer-columns-to-member-events-table.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('members_created_events', 'referrer_source', {
type: 'string',
maxlength: 191,
nullable: true
}),
createAddColu... | 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.10/2022-08-19-14-15-fix-comments-deletion-strategy.js | ghost/core/core/server/data/migrations/versions/5.10/2022-08-19-14-15-fix-comments-deletion-strategy.js | const {addForeign, dropForeign} = require('../../../schema/commands');
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Adding on delete CASCADE for comments pa... | 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.10/2022-08-15-05-34-add-expiry-at-column-to-members-products.js | ghost/core/core/server/data/migrations/versions/5.10/2022-08-15-05-34-add-expiry-at-column-to-members-products.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('members_products', 'expiry_at', {
type: 'dateTime',
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.10/2022-08-16-14-25-add-subscription-created-events-table.js | ghost/core/core/server/data/migrations/versions/5.10/2022-08-16-14-25-add-subscription-created-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('members_subscription_created_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
created_at: {type: 'dateTime', nullable: false},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'member... | 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.10/2022-08-16-14-25-add-member-created-events-table.js | ghost/core/core/server/data/migrations/versions/5.10/2022-08-16-14-25-add-member-created-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('members_created_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
created_at: {type: 'dateTime', nullable: false},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascad... | 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.124/2025-06-06-23-12-11-create-site-uuid-setting.js | ghost/core/core/server/data/migrations/versions/5.124/2025-06-06-23-12-11-create-site-uuid-setting.js | /**
* This migration creates a new setting for the site UUID.
* It will use the `site_uuid` configuration key if it is provided and is a valid UUID.
* Otherwise, it will generate a new random UUID.
*/
const {addSetting} = require('../../utils');
const {getOrGenerateSiteUuid} = require('../../../../services/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.67/2023-10-03-00-32-32-rollback-source-theme.js | ghost/core/core/server/data/migrations/versions/5.67/2023-10-03-00-32-32-rollback-source-theme.js | // For information on writing migrations, see https://www.notion.so/ghost/Database-migrations-eb5b78c435d741d2b34a582d57c24253
const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
// For DDL - schema changes
// const {createNonTransactionalMigration} = require('... | 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.24/2022-11-21-15-57-add-error-columns-for-email-batches.js | ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-15-57-add-error-columns-for-email-batches.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('email_batches', 'error_status_code', {
type: 'integer',
nullable: true,
unsigned: true
}),
createAddColumnMigr... | 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.24/2022-11-21-09-32-add-source-columns-to-emails-table.js | ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-09-32-add-source-columns-to-emails-table.js | const {createAddColumnMigration, combineNonTransactionalMigrations} = require('../../utils');
module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('emails', 'source', {
type: 'text',
maxlength: 1000000000,
fieldtype: 'long',
nullable: true
}),
create... | 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.24/2022-11-21-15-03-populate-source-column-with-html-for-emails.js | ghost/core/core/server/data/migrations/versions/5.24/2022-11-21-15-03-populate-source-column-with-html-for-emails.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Populating source from html in emails table');
const affectedRows = await knex('emails')
.... | 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.55/2023-07-10-05-16-55-add-built-in-collection-posts.js | ghost/core/core/server/data/migrations/versions/5.55/2023-07-10-05-16-55-add-built-in-collection-posts.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
const insertPostCollections = async (knex, collectionId, postIds) => {
logging.warn(`Batch inserting ${postIds.length} collection posts for collection $... | 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.55/2023-07-10-05-15-55-add-built-in-collections.js | ghost/core/core/server/data/migrations/versions/5.55/2023-07-10-05-15-55-add-built-in-collections.js | const logging = require('@tryghost/logging');
const {default: ObjectID} = require('bson-objectid');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
logging.info('Creating built in collections');
const existingL... | 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.31/2023-01-19-07-46-add-mentions-table.js | ghost/core/core/server/data/migrations/versions/5.31/2023-01-19-07-46-add-mentions-table.js | const {addTable} = require('../../utils');
module.exports = addTable('mentions', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
source: {type: 'string', maxlength: 2000, nullable: false},
source_title: {type: 'string', maxlength: 2000, nullable: true},
source_site_title: {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.31/2023-01-17-14-59-add-outbound-link-tagging-setting.js | ghost/core/core/server/data/migrations/versions/5.31/2023-01-17-14-59-add-outbound-link-tagging-setting.js | const {addSetting} = require('../../utils');
module.exports = addSetting({
key: 'outbound_link_tagging',
value: 'true',
type: 'boolean',
group: 'analytics'
});
| 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.31/2022-12-05-09-56-update-newsletter-subscriptions.js | ghost/core/core/server/data/migrations/versions/5.31/2022-12-05-09-56-update-newsletter-subscriptions.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
module.exports = createTransactionalMigration(
async function up(knex) {
const rows = await knex
.pluck('m.id')
.from('members AS m')
.innerJoin('suppressions AS ... | 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.6/2022-07-27-13-40-change-explore-type.js | ghost/core/core/server/data/migrations/versions/5.6/2022-07-27-13-40-change-explore-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 "builtin"');
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.36/2023-02-23-10-40-set-outbound-link-tagging-based-on-source-tracking.js | ghost/core/core/server/data/migrations/versions/5.36/2023-02-23-10-40-set-outbound-link-tagging-based-on-source-tracking.js | const logging = require('@tryghost/logging');
const {createTransactionalMigration} = require('../../utils');
// Set outbound_link_tagging to the current value of members_track_sources
module.exports = createTransactionalMigration(
async function up(connection) {
const reuseValueOfSetting = await connection... | 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.36/2023-02-21-12-29-add-milestone-notifications-column.js | ghost/core/core/server/data/migrations/versions/5.36/2023-02-21-12-29-add-milestone-notifications-column.js | const {createAddColumnMigration} = require('../../utils');
module.exports = createAddColumnMigration('users', 'milestone_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.36/2023-02-20-12-22-add-milestones-table.js | ghost/core/core/server/data/migrations/versions/5.36/2023-02-20-12-22-add-milestones-table.js | const {addTable} = require('../../utils');
module.exports = addTable('milestones', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
type: {type: 'string', maxlength: 24, nullable: false},
value: {type: 'integer', nullable: false},
currency: {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.25/2022-11-24-10-36-add-suppressions-table.js | ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-36-add-suppressions-table.js | const {addTable} = require('../../utils');
module.exports = 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.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js | ghost/core/core/server/data/migrations/versions/5.25/2022-11-24-10-37-add-email-spam-complaint-events-table.js | const {addTable} = require('../../utils');
module.exports = addTable('email_spam_complaint_events', {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
email_id: {type: 'string', m... | 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.