{"id":37190633,"url":"https://github.com/alexandermac/gom","last_synced_at":"2026-01-14T22:00:56.885Z","repository":{"id":196893839,"uuid":"696877721","full_name":"AlexanderMac/gom","owner":"AlexanderMac","description":"A database migration tool for Go applications","archived":false,"fork":false,"pushed_at":"2025-05-10T15:31:19.000Z","size":43,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-10T16:32:32.593Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/AlexanderMac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-26T15:47:52.000Z","updated_at":"2025-05-10T15:31:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a29db5f-df77-4ba3-a0d1-fa257f774346","html_url":"https://github.com/AlexanderMac/gom","commit_stats":null,"previous_names":["alexandermac/gom"],"tags_count":3,"template":false,"template_full_name":"AlexanderMac/go-app-template","purl":"pkg:github/AlexanderMac/gom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderMac%2Fgom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderMac%2Fgom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderMac%2Fgom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderMac%2Fgom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexanderMac","download_url":"https://codeload.github.com/AlexanderMac/gom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderMac%2Fgom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"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-14T22:00:56.083Z","updated_at":"2026-01-14T22:00:56.802Z","avatar_url":"https://github.com/AlexanderMac.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003egom\u003c/h1\u003e\n  \u003cp\u003eA database migration tool for Go applications\u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/alexandermac/gom/actions/workflows/ci.yml?query=branch%3Amaster\"\u003e\u003cimg src=\"https://github.com/alexandermac/gom/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/alexandermac/gom\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/alexandermac/gom\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/alexandermac/gom\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/alexandermac/gom.svg\" alt=\"Go Docs\"\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/alexandermac/gom.svg\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://img.shields.io/github/v/tag/alexandermac/gom\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/alexandermac/gom\" alt=\"GitHub tag\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nGom is a database migration tool. Requires Go v1.18 or higher. It can be run as a command-line tool or injected into the application using embedding SQL migrations.\n\n# Contents\n- [Contents](#contents)\n- [Features](#features)\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [License](#license)\n\n# Features\n- Supports SQLite\n- CLI\n- Embedded migrations\n- Plain SQL for writing schema migrations\n- Incremental migration version using timestamps\n- Run migrations inside a transaction\n- Works in Go v1.18+\n\n# Install\n```sh\ngo install github.com/alexandermac/gom/cmd/gom@latest\n```\n\n# Usage\n\n## CLI\n```\ngom [FLAGS] DRIVER DBSTRING COMMAND\n\nFlags:\n  --dir                Migrations directory name (absolute or relative path)\n  --name               A new migration file suffix\n  --verbose            Prints debug information\n\nDrivers:\n  sqlite\n\nCommands:\n  help                 Shows this help\n  version              Prints app version\n  init                 Creates the migration directory with a sample migration file and the migrations table in the database\n  create               Creates a new migration file\n  migrate              Migrates the DB to the most recent version available\n  rollback             Roll backs the version by 1\n\nExamples:\n  gom --dir db_migrations sqlite ./foo.db init\n  gom --dir db_migrations --name create_users sqlite ./foo.db create\n  gom sqlite ./foo.db migrate\n  gom sqlite ./foo.db rollback\n```\n\n## Embedded migrations\n\nIt's possible to embed sql files into binary and corresponding filesystem abstraction. Such migrations can be applied when the app starts.\n```go\npackage main\n\nimport (\n    \"database/sql\"\n    \"embed\"\n\n    \"github.com/alexandermac/gom\"\n)\n\n//go:embed my_migrations\nvar migrationsDir embed.FS\n\nfunc main() {\n\t// connect the database\n\n\tlog.Println(\"Migrating the database\")\n\tgom.SetBaseFS(migrationsDir)\n\tgom.SetMigrationsDir(\"my_migrations\")\n\tif err := gom.Migrate(db); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n# API\n\n### `func SetBaseFS(fsys simpleFS)`\nSets a base file system to discover migrations. Call this function to pass an embedded migrations variable.\n\n### `func SetMigrationsDir(dir string)`\nSets the migrations directory.\n\n### `func SetLogger(l Logger)`\nSets the logger. Must be compatible with gom.Logger interface.\n\n### `func Create(dir, name, content string) error`\nCreates a new migration file. Used in CLI tool.\n\n### `func Migrate(db *sql.DB) error`\nMigrates the DB to the most recent version available.\n\n### `func Rollback(db *sql.DB) error`\nRoll backs the version by 1.\n\n# License\nLicensed under the MIT license.\n\n# Author\nAlexander Mac\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandermac%2Fgom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandermac%2Fgom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandermac%2Fgom/lists"}