diff --git a/.gitignore b/.gitignore index 12d6222..a07dff7 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,5 @@ ENV/ .vscode/ .idea/ +# Houseplant +ch/ diff --git a/src/houseplant/cli.py b/src/houseplant/cli.py index 2ef1803..0cac43f 100644 --- a/src/houseplant/cli.py +++ b/src/houseplant/cli.py @@ -41,6 +41,12 @@ def migrate(version: str | None = None): hp.migrate(version) +@app.command(name="generate") +def generate(name: str): + """Generate a new migration.""" + hp.generate(name) + + @app.command(hidden=True) def main(): """Console script for houseplant.""" diff --git a/src/houseplant/houseplant.py b/src/houseplant/houseplant.py index 6e99a3f..2e1bfc4 100644 --- a/src/houseplant/houseplant.py +++ b/src/houseplant/houseplant.py @@ -1,5 +1,6 @@ """Main module.""" +import os from rich.console import Console @@ -9,9 +10,15 @@ def __init__(self): def init(self): """Initialize a new houseplant project.""" - # TODO: Implement initialization logic self.console.print("Initializing new houseplant project...") - pass + + # Create ch directory and migrations subdirectory + os.makedirs("ch/migrations", exist_ok=True) + + # Create schema.yml file + open("ch/schema.yml", "a").close() + + self.console.print("✨ Project initialized successfully!") def migrate_status(self): """Show status of database migrations.""" @@ -31,3 +38,8 @@ def migrate_down(self, version: str | None = None): def migrate(self, version: str | None = None): """Run migrations up to specified version.""" self.migrate_up(version) + + def generate(self, name: str): + """Generate a new migration.""" + # TODO: Implement migration generation logic + pass