Skip to content

Commit 298821e

Browse files
github-actions[bot]cuisongliuHUAHUAI23
authored
fix(devbox): Restore the missing migration records (#6602)
fix(devbox): Restore the missing migration records (#6600) * fix(devbox): Restore the missing migration records * chore --------- Co-authored-by: cuisongliu <cuisongliu@qq.com> Co-authored-by: lim <huahua1319873800@outlook.com>
1 parent 1ee4613 commit 298821e

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

frontend/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ fi
9696
RUN if [ "$name" = "devbox" ]; then \
9797
npm install -g prisma@5.10.2; \
9898
fi
99+
RUN if [ "$name" = "devbox" ]; then \
100+
(apk add --no-cache postgresql18-client \
101+
|| apk add --no-cache postgresql17-client \
102+
|| apk add --no-cache postgresql16-client \
103+
|| apk add --no-cache postgresql15-client \
104+
|| apk add --no-cache postgresql-client); \
105+
fi
99106
USER nextjs
100107

101108
# You only need to copy next.config.js if you are NOT using the default configuration

frontend/providers/devbox/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ RUN addgroup --system --gid 1001 nodejs
3636
RUN adduser --system --uid 1001 nextjs
3737

3838
RUN sed -i 's/https/http/' /etc/apk/repositories
39-
RUN apk add curl \
40-
&& apk add ca-certificates \
39+
RUN apk add --no-cache curl ca-certificates \
40+
&& (apk add --no-cache postgresql18-client \
41+
|| apk add --no-cache postgresql17-client \
42+
|| apk add --no-cache postgresql16-client \
43+
|| apk add --no-cache postgresql15-client \
44+
|| apk add --no-cache postgresql-client) \
4145
&& update-ca-certificates
4246

4347
# You only need to copy next.config.js if you are NOT using the default configuration

frontend/providers/devbox/deploy/manifests/deploy.yaml.tmpl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ spec:
4545
- sh
4646
- -c
4747
args:
48-
- cd /app/providers/devbox && prisma migrate deploy
48+
- |-
49+
cd /app/providers/devbox
50+
MIGRATION="20260125094114_add_template_repository_kind"
51+
HAS_MIGRATION=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM _prisma_migrations WHERE migration_name='${MIGRATION}' AND rolled_back_at IS NULL LIMIT 1;")
52+
if [ "$HAS_MIGRATION" = "1" ]; then
53+
prisma migrate deploy
54+
exit 0
55+
fi
56+
HAS_ENUM=$(psql "$DATABASE_URL" -tAc "SELECT 1 FROM pg_enum e JOIN pg_type t ON t.oid = e.enumtypid WHERE t.typname IN ('TemplateRepositoryKind','template_repository_kind') AND e.enumlabel = 'SERVICE' LIMIT 1;")
57+
if [ "$HAS_ENUM" = "1" ]; then
58+
prisma migrate resolve --applied "$MIGRATION"
59+
fi
60+
prisma migrate deploy
4961
containers:
5062
- name: devbox-frontend
5163
env:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterEnum
2+
ALTER TYPE "TemplateRepositoryKind" ADD VALUE 'SERVICE';

0 commit comments

Comments
 (0)