|
|
@ -16,7 +16,7 @@ def start_dev(c):
|
|
|
|
@task
|
|
|
|
@task
|
|
|
|
def stop_dev(c):
|
|
|
|
def stop_dev(c):
|
|
|
|
"""Stops the developer environment."""
|
|
|
|
"""Stops the developer environment."""
|
|
|
|
print("Stoping local development environment.")
|
|
|
|
print("Stopping local development environment...")
|
|
|
|
c.run("docker-compose -f docker-compose.yml down")
|
|
|
|
c.run("docker-compose -f docker-compose.yml down")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +48,16 @@ def stop_redis(c):
|
|
|
|
c.run("docker compose -f docker-compose-redis.yml down")
|
|
|
|
c.run("docker compose -f docker-compose-redis.yml down")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@task
|
|
|
|
|
|
|
|
def init_db(c):
|
|
|
|
|
|
|
|
"""Initialize the database."""
|
|
|
|
|
|
|
|
from project.database import Base, engine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Base.metadata.bind = engine
|
|
|
|
|
|
|
|
Base.metadata.create_all()
|
|
|
|
|
|
|
|
print(f"Created: {engine.url}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@task
|
|
|
|
@task
|
|
|
|
def create_migration(c):
|
|
|
|
def create_migration(c):
|
|
|
|
"""Creates a sqlalchemy migration."""
|
|
|
|
"""Creates a sqlalchemy migration."""
|
|
|
@ -62,8 +72,8 @@ def apply_migration(c, revision="head"):
|
|
|
|
|
|
|
|
|
|
|
|
@task(help={"username": "A username", "email": "The user's email"})
|
|
|
|
@task(help={"username": "A username", "email": "The user's email"})
|
|
|
|
def add_user(c, username="", email=""):
|
|
|
|
def add_user(c, username="", email=""):
|
|
|
|
"Adds a dummy user to the application Database"
|
|
|
|
"""Adds a dummy user to the application Database"""
|
|
|
|
if not username or email:
|
|
|
|
if not (username and email):
|
|
|
|
raise ValueError("You must provide a username and email")
|
|
|
|
raise ValueError("You must provide a username and email")
|
|
|
|
from project.database import SessionLocal
|
|
|
|
from project.database import SessionLocal
|
|
|
|
from project.users.models import User
|
|
|
|
from project.users.models import User
|
|
|
|