IssueRaiser

Prisma Migrate: programmatic access to CLI commands (`deploy`, `reset`...)

## Problem It would be nice to have a way to run the migrate programmatically. I am running into an issue where my api is using lambdas (serverless) and my database is only accessible from within an aws vpc. Because of this I cannot "execute commands" on deploy in an easy way. My current solution is to ssh into an ec2 that is within the vpc, execute the prisma commands, and then spin the ec2 back down. While this is working, it is far from ideal. If I was instead able to have a separate lambda that had all the migration data bundled with it I could execute the migration from a lambda (that is within the vpc). While this may seem like a specialized use case, databases that are not publicly accessible are common place, and solutions for migration that don't include running npm commands from the cli I think become critical. ## Solution ``` import {migrate} from '@prisma/cli'; migrate('up'); ``` ## Alternatives Stated above, no great alternatives for common usecases.

Posted by dested on May 5, 2020, 11:41 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

reliability (Other)

Prisma Migrate: programmatic access to CLI commands (`deploy`, `reset`...)

destedMay 5, 2020, 11:41 PM

## Problem It would be nice to have a way to run the migrate programmatically. I am running into an issue where my api is using lambdas (serverless) and my database is only accessible from within an aws vpc. Because of this I cannot "execute commands" on deploy in an easy way. My current solution is to ssh into an ec2 that is within the vpc, execute the prisma commands, and then spin the ec2 back down. While this is working, it is far from ideal. If I was instead able to have a separate lambda that had all the migration data bundled with it I could execute the migration from a lambda (that is within the vpc). While this may seem like a specialized use case, databases that are not publicly accessible are common place, and solutions for migration that don't include running npm commands from the cli I think become critical. ## Solution ``` import {migrate} from '@prisma/cli'; migrate('up'); ``` ## Alternatives Stated above, no great alternatives for common usecases.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue