docker-library / ghost

Docker Official Image packaging for Ghost
https://hub.docker.com/_/ghost
MIT License
720 stars 311 forks source link

SQLITE_ERROR: no such column: author_id #387

Closed AlexKalopsia closed 1 year ago

AlexKalopsia commented 1 year ago

I've run a ghost:4 container for a long time, though I haven't looked at my blog for a couple of years. Today I spinned up the container again, and I was met with the "We'll be right back. We're busy updating our site to give you the best experience, and will be back soon." page.

I looked at the logs, and I get:

[2023-07-02 15:53:24] ERROR Unhandled rejection: select `id`, `uuid`, `slug`, `comment_id`, `feature_image`, 
`featured`, `type`, `visibility`, `email_recipient_filter`, `author_id`, `created_at`, `created_by`, `updated_at`, 
`updated_by`, `published_at`, `published_by`, `canonical_url`, `newsletter_id` 
from `posts` where (`posts`.`status` = 'published' and `posts`.`type` = 'post') limit 999 
- SQLITE_ERROR: no such column: author_id

Now, starting from the fact that I dunno how this is possible (I assume since I am explicitely on ghost:4 there should have been some breaking changes) , I seem to understand that it's having an issue with the table posts, not finding the column author_id.

In my current database, author_id lives inside the table posts_authors, and I can clearly see it's there and correctly mapped to the posts.

I recreated the container, and sadly I still get the same error.

My compose:

ghost:
    container_name: ghost
    image: ghost:4
    volumes:
      - ${DOCKER_PATH}/ghost:/var/lib/ghost/content
    environment:
      - url=${GHOST_URL}
      - TZ=${TZ}
    ports:
      - 2368:2368
    restart: always
AlexKalopsia commented 1 year ago

EDIT: I took a look and indeed, there was no author_id column, but the author id is inside created_by. I tried creating the column manually with ALTER TABLE posts ADD author_id; and that made Ghost happy.