mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(proxy_cli.py): only run prisma db push if prisma in environment
This commit is contained in:
parent
8a7a745549
commit
3d7c169a58
3 changed files with 67 additions and 50 deletions
|
@ -259,7 +259,7 @@ class PrismaClient:
|
|||
self.proxy_logging_obj = proxy_logging_obj
|
||||
try:
|
||||
from prisma import Prisma # type: ignore
|
||||
except:
|
||||
except Exception as e:
|
||||
os.environ["DATABASE_URL"] = database_url
|
||||
# Save the current working directory
|
||||
original_dir = os.getcwd()
|
||||
|
@ -273,6 +273,10 @@ class PrismaClient:
|
|||
subprocess.run(
|
||||
["prisma", "db", "push", "--accept-data-loss"]
|
||||
) # this looks like a weird edge case when prisma just wont start on render. we need to have the --accept-data-loss
|
||||
except:
|
||||
raise Exception(
|
||||
f"Unable to run prisma commands. Run `pip install prisma`"
|
||||
)
|
||||
finally:
|
||||
os.chdir(original_dir)
|
||||
# Now you can import the Prisma Client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue