[GH-ISSUE #417] DB not created in brand new installation/build (sqlite) #264

Closed
opened 2026-02-25 23:33:49 +03:00 by kerem · 6 comments
Owner

Originally created by @phiatlux on GitHub (Apr 5, 2022).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/417

I am probably doing sth wrong, but it looks like that in a brand new shiori installation/build, the db is not created.
I mean, I'm getting a failed to fetch accounts: SQL logic error: no such table: account (1) (500) when I'm trying to login, or
Failed to create ID: SQL logic error: no such table: bookmark (1), if I try to shiori add

Originally created by @phiatlux on GitHub (Apr 5, 2022). Original GitHub issue: https://github.com/go-shiori/shiori/issues/417 I am probably doing sth wrong, but it looks like that in a brand new shiori installation/build, the db is not created. I mean, I'm getting a **failed to fetch accounts: SQL logic error: no such table: account (1) (500)** when I'm trying to login, or **Failed to create ID: SQL logic error: no such table: bookmark (1)**, if I try to _shiori add_
Author
Owner

@fmartingr commented on GitHub (Apr 6, 2022):

Hey @phiatlux, can you run shiori migrate and check if that creates the tables properly? I added migrations to SQLIte in the latest development version but forgot to add the explanation in the readme, mostly because I need to revamp the docs.

<!-- gh-comment-id:1089862065 --> @fmartingr commented on GitHub (Apr 6, 2022): Hey @phiatlux, can you run `shiori migrate` and check if that creates the tables properly? I added migrations to SQLIte in the latest development version but forgot to add the explanation in the readme, mostly because I need to revamp the docs.
Author
Owner

@phiatlux commented on GitHub (Apr 6, 2022):

@fmartingr you're right! shiori migrate is all it takes. Thank you very much

.

<!-- gh-comment-id:1090078805 --> @phiatlux commented on GitHub (Apr 6, 2022): @fmartingr you're right! `shiori migrate` is all it takes. Thank you very much .
Author
Owner

@wgetgoose commented on GitHub (May 12, 2022):

Just wanted to update that this issue persists in docker as well.

<!-- gh-comment-id:1124521059 --> @wgetgoose commented on GitHub (May 12, 2022): Just wanted to update that this issue persists in docker as well.
Author
Owner

@fmartingr commented on GitHub (May 26, 2022):

Just wanted to update that this issue persists in docker as well.

You need to run shiori migrate for fresh installations and upgrades as well when running shiori under containers.

I've added a mention to this in the docs.

<!-- gh-comment-id:1138907560 --> @fmartingr commented on GitHub (May 26, 2022): > Just wanted to update that this issue persists in docker as well. You need to run `shiori migrate` for fresh installations and upgrades as well when running shiori under containers. I've added a mention to this [in the docs](https://github.com/go-shiori/shiori/blob/master/docs/Usage.md#running-migrations).
Author
Owner

@0xf61 commented on GitHub (Jun 7, 2022):

I did not want to open a new issue, so I am sorry for the resurrection. I tried to deploy on Heroku and this "migrate" thing is kind of annoying. Also, you can't choose which port to listen to on Heroku, so I changed the Dockerfile like this.

# build stage
FROM ghcr.io/ghcri/golang:1.17-alpine3.15 AS builder
WORKDIR /src
COPY . .
RUN go build -ldflags '-s -w'

# server image

FROM ghcr.io/ghcri/alpine:3.15
LABEL org.opencontainers.image.source https://github.com/go-shiori/shiori
COPY --from=builder /src/shiori /shiori/
RUN addgroup -g 1000 shiori \
 && adduser -D -h /shiori -g '' -G shiori -u 1000 shiori
USER shiori
WORKDIR /shiori/
ENV SHIORI_DIR /shiori/
RUN ["/shiori/shiori","--portable","migrate"]
CMD ["sh","-c","/shiori/shiori --portable serve -p $PORT"]
<!-- gh-comment-id:1149068251 --> @0xf61 commented on GitHub (Jun 7, 2022): I did not want to open a new issue, so I am sorry for the resurrection. I tried to deploy on Heroku and this "migrate" thing is kind of annoying. Also, you can't choose which port to listen to on Heroku, so I changed the Dockerfile like this. ```Dockerfile # build stage FROM ghcr.io/ghcri/golang:1.17-alpine3.15 AS builder WORKDIR /src COPY . . RUN go build -ldflags '-s -w' # server image FROM ghcr.io/ghcri/alpine:3.15 LABEL org.opencontainers.image.source https://github.com/go-shiori/shiori COPY --from=builder /src/shiori /shiori/ RUN addgroup -g 1000 shiori \ && adduser -D -h /shiori -g '' -G shiori -u 1000 shiori USER shiori WORKDIR /shiori/ ENV SHIORI_DIR /shiori/ RUN ["/shiori/shiori","--portable","migrate"] CMD ["sh","-c","/shiori/shiori --portable serve -p $PORT"] ```
Author
Owner

@fmartingr commented on GitHub (Jun 8, 2022):

I did not want to open a new issue, so I am sorry for the resurrection. I tried to deploy on Heroku and this "migrate" thing is kind of annoying. Also, you can't choose which port to listen to on Heroku, so I changed the Dockerfile like this.

If I recall correctly, Heroku supports a special release phase for this kind of stuff, you can have a release dyno running the one-off migration command instead of running them on the Dockerfile (which it may not work depending on the situation). I'm not sure what the best solution would be for the port issue, since that is specific to Heroku.

<!-- gh-comment-id:1149534474 --> @fmartingr commented on GitHub (Jun 8, 2022): > I did not want to open a new issue, so I am sorry for the resurrection. I tried to deploy on Heroku and this "migrate" thing is kind of annoying. Also, you can't choose which port to listen to on Heroku, so I changed the Dockerfile like this. If I recall correctly, Heroku supports a special release phase for this kind of stuff, you can have a `release` dyno running the one-off migration command instead of running them on the Dockerfile (which it may not work depending on the situation). I'm not sure what the best solution would be for the port issue, since that is specific to Heroku.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#264
No description provided.