tux.cli.database
¶
Database commands for the Tux CLI.
Functions:
Name | Description |
---|---|
generate | Generate Prisma client. |
push | Push schema changes to database. |
pull | Pull schema from database. |
migrate | Run database migrations. |
reset | Reset database. |
Functions¶
_run_prisma_command(args: list[str], env: dict[str, str]) -> int
¶
Run a Prisma command directly.
When using 'poetry run tux', the prisma binary is already properly configured, so we can run it directly.
Source code in tux/cli/database.py
Python
def _run_prisma_command(args: list[str], env: dict[str, str]) -> int:
"""
Run a Prisma command directly.
When using 'poetry run tux', the prisma binary is already
properly configured, so we can run it directly.
"""
logger.info(f"Using database URL: {env['DATABASE_URL']}")
# Set the environment variables for the process
env_vars = os.environ | env
# Use prisma directly - it's already available through Poetry
try:
logger.info(f"Running: prisma {' '.join(args)}")
return run_command(["prisma", *args], env=env_vars)
except Exception as e:
logger.error(f"Error running prisma command: {e}")
return 1