0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Fixed post meta migration for 3.x (#11438)

no issue

Since we added `email_subject` to `posts_meta` table in `3.1`, the migration tries to add `email_subject` column from post table, which does not exist and thus tries adding `undefined` value for column. Since sqlite expects default values while inserting new columns, this breaks any migration directly from `1.x`/`2.x` to 3.x.

The fix adds a default `null` value for any post_schema entry which doesn't has a value.
This commit is contained in:
Rishabh Garg 2019-12-17 17:14:53 +05:30 committed by GitHub
parent a3c2209420
commit 169daead1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,7 @@ module.exports.up = (options) => {
let postsMetaEntries = _.map(posts, (post) => {
let postsMetaEntry = metaAttrs.reduce(function (obj, entry) {
return Object.assign(obj, {
[entry]: post.get(entry)
[entry]: post.get(entry) || null
});
}, {});
postsMetaEntry.post_id = post.get('id');