Skip to content

Commit 779bf1b

Browse files
committed
Fix fresh install crash
1 parent a6d7ba2 commit 779bf1b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Containerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ COPY --from=prod-deps --chown=bsd:bsd /app/seerr/node_modules /app/seerr/node_mo
124124
COPY --from=build --chown=bsd:bsd /app/seerr/.next /app/seerr/.next
125125
COPY --from=build --chown=bsd:bsd /app/seerr/dist /app/seerr/dist
126126

127+
# Fix fresh-install crash: enable synchronize (creates schema) and skip broken migrations
128+
RUN node -e "let f='/app/seerr/dist/datasource.js',s=require('fs').readFileSync(f,'utf8');require('fs').writeFileSync(f,s.replace('synchronize: false','synchronize: true'))" && \
129+
node -e "let f='/app/seerr/dist/index.js',s=require('fs').readFileSync(f,'utf8');require('fs').writeFileSync(f,s.replace(/await dbConnection\.runMigrations\(\)/g,'/* migrations handled by synchronize */'))"
130+
127131
# Create config directory
128132
RUN mkdir -p /config && chown bsd:bsd /config
129133

Containerfile.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ COPY --from=prod-deps --chown=bsd:bsd /app/seerr/node_modules /app/seerr/node_mo
129129
COPY --from=build --chown=bsd:bsd /app/seerr/.next /app/seerr/.next
130130
COPY --from=build --chown=bsd:bsd /app/seerr/dist /app/seerr/dist
131131

132+
# Fix fresh-install crash: enable synchronize (creates schema) and skip broken migrations
133+
RUN node -e "let f='/app/seerr/dist/datasource.js',s=require('fs').readFileSync(f,'utf8');require('fs').writeFileSync(f,s.replace('synchronize: false','synchronize: true'))" && \
134+
node -e "let f='/app/seerr/dist/index.js',s=require('fs').readFileSync(f,'utf8');require('fs').writeFileSync(f,s.replace(/await dbConnection\.runMigrations\(\)/g,'/* migrations handled by synchronize */'))"
135+
132136
# Create config directory
133137
RUN mkdir -p /config && chown bsd:bsd /config
134138

0 commit comments

Comments
 (0)