Runs
# garden.yml
kind: Run
name: db-migrate
type: container
build: backend
spec:
command: ["rake", "db:migrate"]Examples
Database Migration
kind: Run
name: db-init
type: kubernetes-exec
dependencies: [deploy.db]
spec:
resource:
kind: "StatefulSet"
name: "postgres"
command: [
"/bin/sh",
"-c",
"sleep 15 && PGPASSWORD=postgres psql -w -U postgres --host=postgres --port=5432 -d postgres -c 'CREATE TABLE IF NOT EXISTS votes (id VARCHAR(255) NOT NULL UNIQUE, vote VARCHAR(255) NOT NULL, created_at timestamp default NULL)'",
]
---
kind: Run
name: db-clear
type: kubernetes-exec
dependencies: [deploy.db]
spec:
resource:
kind: "StatefulSet"
name: "postgres"
command:
[
"/bin/sh",
"-c",
"PGPASSWORD=postgres psql -w -U postgres --host postgres --port=5432 -d postgres -c 'TRUNCATE votes'",
]Advanced
Run Artifacts
Runs with arguments from the CLI
Further Reading
Next Steps
Last updated
Was this helpful?

