{"id":39400273,"url":"https://github.com/pengsrc/database-migrator","last_synced_at":"2026-01-18T03:23:41.082Z","repository":{"id":57589173,"uuid":"130965582","full_name":"pengsrc/database-migrator","owner":"pengsrc","description":"Command-line management tools for managing database schema.","archived":false,"fork":false,"pushed_at":"2018-04-26T08:57:11.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T03:55:12.401Z","etag":null,"topics":["database","migration","sql"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengsrc.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":"2018-04-25T07:11:56.000Z","updated_at":"2018-04-26T08:57:13.000Z","dependencies_parsed_at":"2022-09-26T19:34:40.182Z","dependency_job_id":null,"html_url":"https://github.com/pengsrc/database-migrator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pengsrc/database-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengsrc%2Fdatabase-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengsrc%2Fdatabase-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengsrc%2Fdatabase-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengsrc%2Fdatabase-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengsrc","download_url":"https://codeload.github.com/pengsrc/database-migrator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengsrc%2Fdatabase-migrator/sbom","scorecard":{"id":727115,"data":{"date":"2025-08-11","repo":{"name":"github.com/pengsrc/database-migrator","commit":"0955b70671dec144755360b0c1d289960c75a6d1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.1.0 not signed: https://api.github.com/repos/pengsrc/database-migrator/releases/10709893","Warn: release artifact v0.1.0 does not have provenance: https://api.github.com/repos/pengsrc/database-migrator/releases/10709893"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T13:09:07.318Z","repository_id":57589173,"created_at":"2025-08-22T13:09:07.318Z","updated_at":"2025-08-22T13:09:07.318Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28528038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["database","migration","sql"],"created_at":"2026-01-18T03:23:40.384Z","updated_at":"2026-01-18T03:23:41.074Z","avatar_url":"https://github.com/pengsrc.png","language":"Go","readme":"# database-migrator\n\n[![Build Status](https://travis-ci.org/pengsrc/database-migrator.svg?branch=master)](https://travis-ci.org/pengsrc/database-migrator)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pengsrc/database-migrator)](https://goreportcard.com/report/github.com/pengsrc/database-migrator)\n[![License](http://img.shields.io/badge/license-apache%20v2-blue.svg)](https://github.com/pengsrc/database-migrator/blob/master/LICENSE)\n\nCommand-line management tools for managing database schema, inspired by Rails Active Record, works like `rake db:migrate`.\n\nRead [_Active Record Migrations_](http://guides.rubyonrails.org/active_record_migrations.html) in [Rails Guide](http://guides.rubyonrails.org) to know the principle of database migration. The difference have to be aware is that `database-migrator` takes SQL files directly instead of model definitions in Rails.\n\n## Installation\n\n### Install from Source Code\n\n``` bash\n$ git clone git@github.com:pengsrc/database-migrator.git\n$ cd database-migrator\n$ glide install\n...\n[INFO]\tReplacing existing vendor dependencies\n$ make install\n...\nInstalling into /data/go/bin/database-migrator...\nDone\n```\n\n### Download Precompiled Binary\n\n1. Go to [releases tab](https://github.com/pengsrc/database-migrator/releases) and download the binary for your operating system.\n2. Unarchive the downloaded file, and put the executable file `database-migrator` into a directory that in the `$PATH` environment variable, for example `/usr/local/bin`.\n3. Run `database-migrator --help` to get started.\n\n## Usage\n\nThe `database-migrator` contains some sub commands, each of them support `--help` flag to print out all supported parameters.\n\n``` Bash\n$ database-migrator --help\nDatabase schema migration tool\n\nUsage:\n  database-migrator [flags]\n  database-migrator [command]\n\nAvailable Commands:\n  down        Revert one migration\n  help        Help about any command\n  new         Create an new migration\n  status      Show database schema status\n  sync        Sync database schema\n  up          Run one migration\n\nFlags:\n  -h, --help   help for database-migrator\n\nUse \"database-migrator [command] --help\" for more information about a command.\n```\n\n``` Bash\n$ database-migrator sync --help\nSync database schema\n\nUsage:\n  database-migrator sync [flags]\n\nFlags:\n  -d, --database string     Specify database name\n      --dialect string      Specify database dialect (default \"MySQL\")\n      --help                Show help\n  -h, --host string         Specify database host (default \"127.0.0.1\")\n  -m, --migrations string   Specify migration files\n  -P, --password string     Specify password\n  -p, --port int            Specify database port (default 3306)\n  -u, --user string         Specify user (default \"root\")\n```\n\n## Example\n\n### Migration Files\n\nCreate a directories to keep migration files, and create a migration file.\n\n``` Bash\n$ mkdir migrations\n\n$ database-migrator new -m migrations -n create_objects\nNew migration created at \"migrations/20180425065739_create_objects.sql\".\n\n$ cat migrations/20180425065739_create_objects.sql\n-- +migrate Up\n-- SQL in section 'Up' is executed when this migration is applied.\nCREATE TABLE `examples` (\n  `id` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n  PRIMARY KEY (`id`)\n)\n  ENGINE = InnoDB\n  AUTO_INCREMENT = 10000\n  DEFAULT CHARSET = utf8;\n\n-- +migrate Down\n-- SQL section 'Down' is executed when this migration is rolled back.\nDROP TABLE `examples`;\n```\n\nThe `Up` and `Down` section are pretty much similar to the `up` and `down` method in Rails model, see [_Using the up/down Methods_](http://guides.rubyonrails.org/active_record_migrations.html#using-the-up-down-methods) to get a better understanding.\n\n### Run\n\nCheck current status.\n\n``` Bash\n$ database-migrator status -h 127.0.0.1 -p 3306 -u root -P root -d test -m migrations\nApplied At               Migration\n================================================================================\nPending               -  20180425065739_create_objects\n```\n\nSync status.\n\n``` Bash\n$ database-migrator sync -h 127.0.0.1 -p 3306 -u root -P root -d test -m migrations\nMigrated to the latest database schema.\n- 20180425065739_create_objects\n\n$ database-migrator status -h 127.0.0.1 -p 3306 -u root -P root -d test -m migrations\nApplied At               Migration\n================================================================================\n2018-04-25T07:04:27Z  -  20180425065739_create_objects\n```\n\nApply/Revert one by one.\n\n``` Bash\n$ database-migrator down -h 127.0.0.1 -p 3306 -u root -P root -d test -m migrations\nRevert migration complete, 20180425065739_create_objects.\n\n$ database-migrator up -h 127.0.0.1 -p 3306 -u root -P root -d test -m migrations\nRun migration complete, 20180425065739_create_objects.\n```\n\n## Notices\n\n- The `database-migrator` creates a table named `schema_migrations` to track schema history.\n- Currently, only MySQL direct is supported.\n\n## LICENSE\n\nThe Apache License (Version 2.0, January 2004).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengsrc%2Fdatabase-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengsrc%2Fdatabase-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengsrc%2Fdatabase-migrator/lists"}