{"id":36860198,"url":"https://github.com/usvc/db","last_synced_at":"2026-01-12T14:49:25.425Z","repository":{"id":57514065,"uuid":"248645966","full_name":"usvc/db","owner":"usvc","description":"Database data management toolkit","archived":false,"fork":false,"pushed_at":"2020-03-28T10:20:31.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T22:04:26.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usvc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-20T01:58:15.000Z","updated_at":"2020-04-01T18:28:26.000Z","dependencies_parsed_at":"2022-09-26T17:01:00.987Z","dependency_job_id":null,"html_url":"https://github.com/usvc/db","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/usvc/db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usvc","download_url":"https://codeload.github.com/usvc/db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-12T14:49:25.341Z","updated_at":"2026-01-12T14:49:25.406Z","avatar_url":"https://github.com/usvc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DB\n\n[![latest release](https://badge.fury.io/gh/usvc%2Fdb.svg)](https://github.com/usvc/db/releases)\n[![pipeline status](https://gitlab.com/usvc/utils/db/badges/master/pipeline.svg)](https://gitlab.com/usvc/utils/db/-/commits/master)\n[![Build Status](https://travis-ci.org/usvc/db.svg?branch=master)](https://travis-ci.org/usvc/db)\n\u003c!-- // to add when ready\n[![Test Coverage](https://api.codeclimate.com/v1/badges/f5311cc9a7bd253f3c4a/test_coverage)](https://codeclimate.com/github/usvc/db/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/f5311cc9a7bd253f3c4a/maintainability)](https://codeclimate.com/github/usvc/db/maintainability)\n--\u003e\n\nAn easy-peasy database CLI tool.\n\n| Find it on | URL |\n| --- | --- |\n| Github | [https://github.com/usvc/db](https://github.com/usvc/db) |\n| Gitlab | [https://gitlab.com/usvc/utils/db](https://gitlab.com/usvc/utils/db) |\n\n- [DB](#db)\n- [Usage](#usage)\n  - [Quick Overview](#quick-overview)\n  - [Show Help](#show-help)\n  - [Check Database Credentials/Connection](#check-database-credentialsconnection)\n  - [Migrate Database](#migrate-database)\n  - [Exit Codes](#exit-codes)\n- [Configuration](#configuration)\n  - [Environment Variables](#environment-variables)\n- [Development Runbook](#development-runbook)\n  - [Getting Started](#getting-started)\n  - [Continuous Integration (CI) Pipeline](#continuous-integration-ci-pipeline)\n    - [On Github](#on-github)\n      - [Releasing](#releasing)\n    - [On Gitlab](#on-gitlab)\n      - [Version Bumping](#version-bumping)\n      - [DockerHub Publishing](#dockerhub-publishing)\n- [Licensing](#licensing)\n\n- - -\n\n# Usage\n\n## Quick Overview\n\n```sh\n# show help\ndb --help;\n\n# check database credentials/connection\ndb check;\n\n# migrate database to the next step only (using files at ./path/to/migrations)\ndb migrate ./path/to/migrations;\n\n# migrate database upwards for two steps only (using files at ./path/to/migrations)\ndb migrate --steps 2 ./path/to/migrations;\n\n# migrate database to the latest step (using files at ./path/to/migrations)\ndb migrate --latest ./path/to/migrations;\n\n# rollback database to the previous step only (using files at ./path/to/migrations)\ndb rollback ./path/to/migrations;\n\n# rollback database two steps only (using files at ./path/to/migrations)\ndb rollback --steps 2 ./path/to/migrations;\n```\n\n## Show Help\n\nThe `--help` flag shows all possible flags/sub-commands. The configurations can also be found below in alphabetical order:\n\n| Flag | Default Value | Description |\n| --- | --- | --- |\n| `-d, --driver` | `\"mysql\"` | Defines the database driver to use (only MySQL is supported for now) |\n| `-H, --host` | `\"localhost\"` | Defines the hostname at which the database server can be reached at |\n| `-f, --log-format` | `\"text\"` | Defines the format of the logger according to [`github.com/usvc/go-logger`](https://github.com/usvc/go-logger). Other values: [`\"json\"`] |\n| `-t, --log-type` | `\"stdout\"` | Defines the type of the logger according to [`github.com/usvc/go-logger`](github.com/usvc/go-logger). Other values: [`\"levelled\"`] |\n| `-p, --password` | `\"password\"` | Defines the password of the user used to login to the database server |\n| `-P, --port` | `3306` | Defines the port at which the database server can be reached |\n| `-r, --retry-count` | `5` | Defines the number of times the application will re-attempt a failed connection to the database |\n| `-R, --retry-interval-ms` | `3000` | Defines the number of milliseconds in between database connection retry attempts |\n| `-u, --username` | `\"user\"` | Defines the username of the user used to login to the database server |\n\n## Check Database Credentials/Connection\n\nThe `check` sub-command \n\n## Migrate Database\n\n## Exit Codes\n\n| Exit Code | Description |\n| --- | --- |\n| 0 | Success |\n| 1 | Success with some migrations still not applied |\n| 127 | Invalid arguments detected |\n| 128 | Error while accessing the file system |\n| 129 | Error while connecting to the database |\n| 130 | Error while reading the migrations |\n| 131 | Error while applying the migrations |\n\n- - -\n\n# Configuration\n\n## Environment Variables\n\n\u003e `WIP`\n\n| Key | Default Value | Description |\n| --- | --- | --- |\n| | |\n\n- - -\n\n# Development Runbook\n\n## Getting Started\n\n1. Clone this repository\n2. Run `make deps` to pull in external dependencies\n3. Write some awesome stuff\n4. Run `make test` to ensure unit tests are passing\n5. Push\n\n## Continuous Integration (CI) Pipeline\n\n### On Github\n\nGithub is used to deploy binaries/libraries because of it's ease of access by other developers.\n\n#### Releasing\n\nReleasing of the binaries can be done via Travis CI.\n\n1. On Github, navigate to the [tokens settings page](https://github.com/settings/tokens) (by clicking on your profile picture, selecting **Settings**, selecting **Developer settings** on the left navigation menu, then **Personal Access Tokens** again on the left navigation menu)\n2. Click on **Generate new token**, give the token an appropriate name and check the checkbox on **`public_repo`** within the **repo** header\n3. Copy the generated token\n4. Navigate to [travis-ci.org](https://travis-ci.org) and access the cooresponding repository there. Click on the **More options** button on the top right of the repository page and select **Settings**\n5. Scroll down to the section on **Environment Variables** and enter in a new **NAME** with `RELEASE_TOKEN` and the **VALUE** field cooresponding to the generated personal access token, and hit **Add**\n\n### On Gitlab\n\nGitlab is used to run tests and ensure that builds run correctly.\n\n#### Version Bumping\n\n1. Run `make .ssh`\n2. Copy the contents of the file generated at `./.ssh/id_rsa.base64` into an environment variable named **`DEPLOY_KEY`** in **Settings \u003e CI/CD \u003e Variables**\n3. Navigate to the **Deploy Keys** section of the **Settings \u003e Repository \u003e Deploy Keys** and paste in the contents of the file generated at `./.ssh/id_rsa.pub` with the **Write access allowed** checkbox enabled\n\n- **`DEPLOY_KEY`**: generate this by running `make .ssh` and copying the contents of the file generated at `./.ssh/id_rsa.base64`\n\n#### DockerHub Publishing\n\n1. Login to [https://hub.docker.com](https://hub.docker.com), or if you're using your own private one, log into yours\n2. Navigate to [your security settings at the `/settings/security` endpoint](https://hub.docker.com/settings/security)\n3. Click on **Create Access Token**, type in a name for the new token, and click on **Create**\n4. Copy the generated token that will be displayed on the screen\n5. Enter the following varialbes into the CI/CD Variables page at **Settings \u003e CI/CD \u003e Variables** in your Gitlab repository:\n\n- **`DOCKER_REGISTRY_URL`**: The hostname of the Docker registry (defaults to `docker.io` if not specified)\n- **`DOCKER_REGISTRY_USERNAME`**: The username you used to login to the Docker registry\n- **`DOCKER_REGISTRY_PASSWORD`**: The generated access token\n\n- - -\n\n# Licensing\n\nCode here is licensed under the [MIT license](./LICENSE) by [@zephinzer](https://gitlab.com/zephinzer).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusvc%2Fdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusvc%2Fdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusvc%2Fdb/lists"}