Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-hosting migration fails if not using the default "public" schema #886

Closed
swag42dev opened this issue Feb 7, 2024 · 8 comments
Closed

Comments

@swag42dev
Copy link

@swag42dev
Copy link
Author

code: 'P2010',

clientVersion: '5.4.1',

meta: { code: '42P01', message: 'relation "public.JobRun" does not exist' }

}

@swag42dev
Copy link
Author

and migration which fails if project hosted in custom schema eg "triggerdotdev"
CREATE INDEX idx_jobrun_jobId_createdAt ON "public"."JobRun" ("jobId", "createdAt" DESC);

@swag42dev swag42dev changed the title typo which stops server Bug:typo which stops server Feb 7, 2024
@swag42dev swag42dev changed the title Bug:typo which stops server bug: typo which stops server Feb 7, 2024
@matt-aitken matt-aitken changed the title bug: typo which stops server Self-hosting: JobListPresenter has a hardcoded "public" schema in a query Feb 7, 2024
@matt-aitken
Copy link
Member

Good spot, a fix for this has been pushed to main. I'm creating another latest build right now, should be available in 10 mins to use.

@matt-aitken
Copy link
Member

Ah shit I didn't spot the migration

@matt-aitken matt-aitken reopened this Feb 7, 2024
@matt-aitken
Copy link
Member

@swag42dev unfortunately it's not going to be easy to fix that migration. It's already been applied and just editing the file isn't an option as that causes an out-of-sync issue which would wipe everyone's databases when deploying.

There are complicated options Prisma offers but I'm not clear on the best approach at the moment.

I think you can manually resolve for yourself by doing this:

  1. Run this on your database, it will mark that migration as done (even though it isn't):
prisma migrate resolve --applied "20240130165343_add_composite_index_to_job_run_for_job_id_and_created_at"
  1. Manually perform the SQL migration to create the composite index:
CREATE INDEX idx_jobrun_jobId_createdAt ON "JobRun" ("jobId", "createdAt" DESC);

Sorry about this. That migration was auto-generated by Prisma when I used their @@Index notation… 😠

@matt-aitken matt-aitken changed the title Self-hosting: JobListPresenter has a hardcoded "public" schema in a query Self-hosting migration fails if not using the default "public" schema Feb 7, 2024
@swag42dev
Copy link
Author

@matt-aitken no problem. i already fix migration. thank you for quick fix

@brentshulman-silkline
Copy link

This is and extremely annoying and causing issues with deploying on ECS that:

  1. Make the docs incorrect
  2. Means I need to deploy a separate db

@matt-aitken
Copy link
Member

There's a more up to date issue on this with a better temporary fix: #1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants