As of December 1st, 2019 Buffalo, and all related packages, require Go Modules and the use of the GOPATH is no longer supported.

Please see this blog post for more information https://blog.gobuffalo.io/the-road-to-1-0-requiring-modules-5672c6b015e5.

Soda CLI

Pop helps you to manage database connections, but it also provides soda, a small CLI toolbox to manage your database. It can help you to create a new database, drop existing ones, and so on.

Note for Buffalo users: soda commands are embedded into the buffalo command, behind the pop namespace. So every time you want to use a command from soda, just execute buffalo pop instead. You don't need to install soda CLI.

Installing CLI Support

From a release archive

Pre-compiled archives contain Soda with SQLite support.

Download the appropriate version for your platform from Pop releases.

Place it somewhere in your PATH, and ensure the soda binary is executable.

Homebrew (macOS)

$ brew install gobuffalo/tap/pop

From source

Without sqlite 3 support:

$ go get github.com/gobuffalo/pop/...
$ go install github.com/gobuffalo/pop/soda

With sqlite 3 support (requires GCC or equivalent C compiler):

$ go get -u -v -tags sqlite github.com/gobuffalo/pop/...
$ go install -tags sqlite github.com/gobuffalo/pop/soda

If you're not building your code with buffalo build, you'll also have to pass -tags sqlite to go build when building your program.

Creating Databases

Once the database.yml has been configured with the appropriate settings, and the database server is running, Soda can create all of the databases in the database.yml file with a simple command:

$ soda create -a

You can also create just one of the configured databases by using the -e flag and the name of the database:

$ soda create -e test

Dropping Databases

Soda can drop all of your databases, should you want to, with one command:

$ soda drop -a

You can also drop just one of the configured databases by using the -e flag and the name of the database:

$ soda drop -e test