Skip to content
Download as .md

gorun CLI

Written by Rohman Beny Riyanto

Who this page is for

This is a tool for people running this backend project itself (setting up a local database, applying migrations, seeding data) - not something an API consumer needs to touch to call the endpoints. Skip it unless you're setting up or operating this project's own environment.

gorun is github.com/RohmanBenyRiyanto/gorun - a published, standalone CLI toolkit for provisioning a database, applying schema changes ("migrations"), and populating baseline data ("seeders") for a Go project. This project uses it for exactly that during local setup and deployment. Full command/flag reference lives in its own docs:

Two ways to invoke it, from the repo root:

bash
go run ./cmd/gorun-runner <command>   # always up to date, no install needed
gorun <command>                       # after installing gorun globally + .gorun/config.yaml is set up

Example, fully non-interactive:

bash
gorun migrate run --engine mysql --database videotron_v2_dev --force

Gotchas

  • db truncate vs table truncate - db truncate --name X wipes every table in database X, table truncate --name Y --database X wipes one table. Don't reach for the wrong one.
  • Schema changes only happen through migration files - there's a config setting for automatic schema syncing, but it isn't actually wired up; it's not a real path for changing the database schema. The versioned SQL migration files, applied via gorun migrate, are the only way schema changes actually happen.
  • seed run --force and migrate run --force mean different things - migrate's --force skips the "run these pending migrations?" confirmation; seed's --force is specifically the guard against accidentally reseeding production. Neither implies the other.