Skip to content

Repository files navigation

kcapp logo

database

Database schema is managed using Goose database migration tool

Configuration

Docker

Database can be setup using Docker.

Configure the database environment in docker-compose.yml. (If you hate defaults...)

environment:
  - MYSQL_DATABASE: <schema_name>
  - MYSQL_USER: <username>
  - MYSQL_PASSWORD: <password>
  - MYSQL_ROOT_PASSWORD: <root_password>

Then execute, to start docker image in detached mode

docker-compose up -d

Migrations

Migrations are handled with Golang + Goose library

Installation

To install goose

go get -u github.com/pressly/goose/cmd/goose

For a full list of migration commands see Goose usage

Migration Status

cd migrations
goose mysql "kcapp:abcd1234@tcp(localhost:3366)/kcapp?parseTime=true" status

Apply New Migrations

cd migrations
goose mysql "kcapp:abcd1234@tcp(localhost:3366)/kcapp?parseTime=true" up

Creating new Migrations

To create a new migration run

cd migrations
goose create create_table_my_new_table sql

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages