trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

[TRI-1948] Self-hosting: non-public schemas will fail on the initial db migrations

Open matt-aitken opened this issue 1 year ago • 2 comments

A migration was accidentally added that had a hard-coded reference to "public". We can't just remove that because it will cause a mismatch between the applied migrations table hash and the migration files.

Potential fix

  • Update the migration to fix it.
  • Add a script that runs before db migrate deploy in shell startup script.
    • Update hash for the bad migration.
    • Make that SQL available to run somewhere else, maybe in a Readme

From SyncLinear.com | TRI-1948

matt-aitken avatar Apr 12 '24 14:04 matt-aitken

A temporary workaround for new docker deploys: (do NOT use for existing deploys!)

services:
  triggerdotdev:
    # These values may differ in your deploy 
    image: ghcr.io/triggerdotdev/trigger.dev:latest
    container_name: triggerdotdev
    restart: always
    env_file:
      - .env
    ports:
      - 3030:3030
    depends_on:
      - triggerdotdev-database
    networks:
      - app_network
    # This is the important bit!
    command:
      - sh
      - -c
      - sed -i s/public/triggerdotdev/ ./packages/database/prisma/migrations/20240130165343_add_composite_index_to_job_run_for_job_id_and_created_at/migration.sql && ./scripts/entrypoint.sh

nicktrn avatar Apr 12 '24 14:04 nicktrn

Up - would be great to find a solution to this problem soon

kevinmeyer227 avatar Sep 26 '24 16:09 kevinmeyer227