fix: add TEAM_BONUS cleanup to startup scripts
Delete incorrect TEAM_BONUS records (where account_sequence != source_account_sequence) on each container startup after migrations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ff3a614804
commit
d68ee398ab
|
|
@ -37,7 +37,7 @@ RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
|
|||
|
||||
COPY --chown=nestjs:nodejs --from=builder /app/dist ./dist
|
||||
|
||||
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy\necho "Starting application..."\nexec node dist/main.js\n' > /app/start.sh && chmod +x /app/start.sh
|
||||
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy\necho "Cleaning up incorrect TEAM_BONUS records..."\nnpx prisma db execute --stdin <<EOF\nDELETE FROM contribution_records WHERE source_type = '"'"'TEAM_BONUS'"'"' AND account_sequence != source_account_sequence;\nEOF\necho "Starting application..."\nexec node dist/main.js\n' > /app/start.sh && chmod +x /app/start.sh
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
|
|||
COPY --chown=nestjs:nodejs --from=builder /app/dist ./dist
|
||||
|
||||
# 创建启动脚本
|
||||
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy\necho "Starting application..."\nexec node dist/main.js\n' > /app/start.sh && chmod +x /app/start.sh
|
||||
RUN printf '#!/bin/sh\nset -e\necho "Running database migrations..."\nnpx prisma migrate deploy\necho "Cleaning up incorrect TEAM_BONUS records..."\nnpx prisma db execute --stdin <<EOF\nDELETE FROM synced_contribution_records WHERE source_type = '"'"'TEAM_BONUS'"'"' AND account_sequence != source_account_sequence;\nEOF\necho "Starting application..."\nexec node dist/main.js\n' > /app/start.sh && chmod +x /app/start.sh
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
|
|
|||
Loading…
Reference in New Issue