fresh-yak-35965
06/10/2024, 5:09 PMkind: Run
type: container
name: migrate-generate
build: api
description: Perform alembic migration
dependencies:
- deploy.cockroach-db
- run.cockroach-seed-users
spec:
command:
- hatch
- run
- python
- -m
- alembic
- revision
- --autogenerate
- ${command.$rest}
env:
PYTHONPATH: ./src
NATS_URL: "nats://nats-server:4222"
SQLALCHEMY_DATABASE_URL: "roach:roach@cockroachdb:26257/kraken"
microscopic-river-74022
06/10/2024, 5:09 PMmicroscopic-river-74022
06/10/2024, 5:09 PM$concat
function to pass any additional parameters through to the command without validation. Here's how you can modify your garden.yml
file:
yaml
kind: Run
type: container
name: migrate-generate
build: api
description: Perform alembic migration
dependencies:
- deploy.cockroach-db
- run.cockroach-seed-users
spec:
command:
- hatch
- run
- python
- -m
- alembic
- revision
- --autogenerate
- $concat: ${args.$rest} # <- pass any additional parameters through to the command without validation
env:
PYTHONPATH: ./src
NATS_URL: "nats://nats-server:4222"
SQLALCHEMY_DATABASE_URL: "roach:roach@cockroachdb:26257/kraken"
Now you can run your command with additional flags like this: garden run migrate-generate -- -m "Create applications table"
. The -m "Create applications table"
portion will be passed to the underlying command.
Please note that this feature is part of Garden's advanced custom commands functionality. You can read more about it in the official Garden documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
06/10/2024, 5:09 PM