{"id":37173946,"url":"https://github.com/guilhermewebdev/migrator","last_synced_at":"2026-01-14T20:19:45.027Z","repository":{"id":176762891,"uuid":"656436867","full_name":"guilhermewebdev/migrator","owner":"guilhermewebdev","description":"Migrator is a command-line tool designed for seamless database management through migrations. With features for creating, executing, and rolling back migrations, Migrator ensures a controlled evolution of your database schema. Take charge of your database changes effortlessly with Migrator.","archived":false,"fork":false,"pushed_at":"2024-12-08T15:55:48.000Z","size":113,"stargazers_count":15,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-08T16:26:56.484Z","etag":null,"topics":["cli","database","golang","golang-application","golang-library","golang-package","mariadb","migration","migrations","mysql","oracle-database","postgresql","sql","sqlserver"],"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/guilhermewebdev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-21T00:51:13.000Z","updated_at":"2024-03-21T23:22:15.000Z","dependencies_parsed_at":"2024-12-08T16:22:19.864Z","dependency_job_id":"c890be6d-3e0d-47e0-940b-f0317777f6c3","html_url":"https://github.com/guilhermewebdev/migrator","commit_stats":null,"previous_names":["guilhermewebdev/migrator"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/guilhermewebdev/migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilhermewebdev%2Fmigrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilhermewebdev%2Fmigrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilhermewebdev%2Fmigrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilhermewebdev%2Fmigrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guilhermewebdev","download_url":"https://codeload.github.com/guilhermewebdev/migrator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilhermewebdev%2Fmigrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","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":["cli","database","golang","golang-application","golang-library","golang-package","mariadb","migration","migrations","mysql","oracle-database","postgresql","sql","sqlserver"],"created_at":"2026-01-14T20:19:44.306Z","updated_at":"2026-01-14T20:19:45.012Z","avatar_url":"https://github.com/guilhermewebdev.png","language":"Go","readme":"# Migrator - Database Migration Command Line Tool\n\n## Overview\n\n**Migrator** is a command-line tool designed to simplify the management of databases using migrations. It enables users to create, execute, and roll back migrations, ensuring a smooth and controlled evolution of the database schema.\n\n## Version\n\nCurrent version: 0.3\n\n## Author\n\nGuilherme Isaías \u003cguilherme@cibernetica.dev\u003e\n\n## Installation\n\n### Building from source code\n\n#### Prerequisites\n\nMake sure your system meets the following requirements:\n\nGo: Ensure that Go is installed on your machine. You can download and install it from [the official Go website](https://go.dev/doc/install).\n\nDocker (optional): If you plan to build and run the migrator tool in a Docker container, make sure Docker is installed on your system. You can find instructions for installing Docker [here](https://docs.docker.com/engine/install/).\n\n#### Building and Installing\n1. Clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/guilhermewebdev/migrator.git\n```\n\nChange into the project directory:\n\n```bash\ncd migrator\n```\n\nRun the build command using the provided \nMakefile:\n\n```bash\nmake build\n```\n\nThis will compile the migrator tool.\nInstall the migrator tool globally on your system:\n\n```bash\nmake install\n```\n\nThis will copy the compiled executable to /usr/local/bin/, making it accessible system-wide.\n\n## Docker\n\nYou can also use a pre-built Docker image for Migrator available on Docker Hub. The image is hosted at [guilhermewebdev/migrator](https://hub.docker.com/r/guilhermewebdev/migrator). To run Migrator using Docker, use the following command:\n\n```bash\ndocker run -it guilhermewebdev/migrator:latest migrate [global options] command [command options] [arguments...]\n```\n\nReplace `[global options]`, `command`, `[command options]`, and `[arguments...]` with the specific options and commands you want to execute.\n\n### Example using Docker\n\n```bash\n# Create a new migration using Docker\ndocker run -it guilhermewebdev/migrator:latest migrate new migration_name\n```\n\nThis will execute the specified Migrator command inside a Docker container based on the provided image.\n\nNote: Ensure that you have Docker installed on your machine. You can find instructions for installing Docker [here](https://docs.docker.com/engine/install/).\n\n## Usage\n\n```shell\nmigrate [global options] command [command options] [arguments...]\n```\n\n## Commands\n\n1. **init**\n   - Create a new config file.\n\n2. **new**\n   - Creates a new migration.\n\n3. **up**\n   - Executes the next migration.\n\n4. **down**\n   - Rolls back the last migration.\n\n5. **unlock**\n   - Unlocks migrations.\n\n6. **latest**\n   - Performs missing migrations.\n\n7. **settings**\n   - Show settings.\n\n8. **help, h**\n   - Shows a list of commands or help for one command.\n\n## Global Options\n\n- `--conf-file FILE, -c FILE`\n  - Load configuration from FILE (default: \"migrator.yml\").\n\n- `--migrations value, -m value`\n  - Select the migrations directory (default: \"./migrations\").\n\n- `--dsn value, -d value`\n  - Database connection string.\n\n- `--driver value, -r value`\n  - Database driver (mysql, postgres, sqlserver, sqlite, sqlite3, or oracle).\n\n- `--table value, -t value`\n  - Migrations table name (default: \"migrations\").\n\n- `--help, -h`\n  - Show help.\n\n- `--version, -v`\n  - Print the version.\n\n## Example\n\n```shell\n# Create a new migration\nmigrate -c ./db/migrator.yml new \u003cmigration_name\u003e\n\n# Execute the next migration\nmigrate --driver mysql up\n\n# Rollback the last migration\nmigrate down\n\n# Unlock migrations\nmigrate unlock\n\n# Perform missing migrations\nmigrate latest\n```\n\n## Environment Variable Configuration\n\nYou can apply configurations to Migrator using environment variables. The following variables are supported:\n\n- `DB_DSN`: Database connection string.\n- `DB_DRIVER`: Database driver (mysql, postgres, sqlserver, sqlite, sqlite3, or oracle).\n- `MIGRATIONS_DIR`: Select the migrations directory (default: \"./migrations\").\n- `MIGRATIONS_TABLE`: Migrations table name (default: \"migrations\").\n\nTo set these variables, you can use your shell's syntax. For example, in Bash:\n\n```bash\nexport DB_DSN=\"your_database_connection_string\"\nexport DB_DRIVER=\"your_database_driver\"\nexport MIGRATIONS_DIR=\"your_migrations_directory\"\nexport MIGRATIONS_TABLE=\"your_migrations_table_name\"\n```\n\n## Configuration File\n\nBy default, Migrate looks for a configuration file named \"migrator.yml\" for global settings. You can specify an alternative configuration file using the `--conf-file` option.\n\nThe `migrator.yml` file is used to configure settings for the Migrator command-line tool. Below is an example of the configuration file syntax along with explanations of each parameter:\n\n```yaml\n# Example migrator.yml Configuration File\n\n# Directory where migration files are stored\nmigrations_dir: ./migrations\n\n# Name of the table to track migrations in the database\nmigrations_table_name: migrations\n\n# Database connection string (DSN)\ndb_dsn: \"postgres://user:pass@postgres:5432/test?sslmode=disable\"\n\n# Database driver (Supported drivers: mysql, postgres, sqlserver, sqlite, sqlite3, oracle)\ndb_driver: postgres\n```\n\n**Explanation:**\n\n1. `migrations_dir`: Specifies the directory where migration files are located. In the example, migrations are expected to be in the `./migrations` directory. You can customize this path according to your project structure.\n\n2. `migrations_table_name`: Defines the name of the table used to track migrations in the database. The default is set to \"migrations,\" but you can modify it based on your preferences.\n\n3. `db_dsn`: Represents the Database Source Name (DSN), which contains information about the database connection. In the example, a PostgreSQL database connection string is provided. Update this with the appropriate credentials and connection details for your database.\n\n4. `db_driver`: Specifies the database driver to be used (e.g., mysql, postgres, sqlserver, sqlite, sqlite3, oracle). In the example, the driver is set to \"postgres.\" Choose the appropriate driver based on your database system.\n\nEnsure that the information in the `migrator.yml` file accurately reflects your database setup. You can customize these parameters to suit your project's requirements. If needed, refer to the [Global Options](#global-options) section in the README for additional options that can be specified when running Migrate commands.\n\n---\n\nFor additional information on each command and its options, use:\n\n```shell\nmigrate [command] --help\n```\n\nThank you for using Migrator! If you have any questions or feedback, please contact Guilherme Isaías at \u003cguilherme@cibernetica.dev\u003e.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilhermewebdev%2Fmigrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilhermewebdev%2Fmigrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilhermewebdev%2Fmigrator/lists"}