{"id":36493869,"url":"https://github.com/tmus/exodus","last_synced_at":"2026-01-12T01:58:54.336Z","repository":{"id":57592861,"uuid":"187603884","full_name":"tmus/exodus","owner":"tmus","description":"🏃 A database migration runner for Go, using a database-agnostic schema DSL to enable database migrations for any underlying database.","archived":false,"fork":false,"pushed_at":"2022-02-26T11:45:04.000Z","size":134,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T01:56:21.263Z","etag":null,"topics":["database","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmus.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-20T08:53:24.000Z","updated_at":"2022-04-17T11:04:14.000Z","dependencies_parsed_at":"2022-09-26T19:43:30.570Z","dependency_job_id":null,"html_url":"https://github.com/tmus/exodus","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tmus/exodus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmus%2Fexodus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmus%2Fexodus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmus%2Fexodus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmus%2Fexodus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmus","download_url":"https://codeload.github.com/tmus/exodus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmus%2Fexodus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"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":["database","go"],"created_at":"2026-01-12T01:58:53.720Z","updated_at":"2026-01-12T01:58:54.325Z","avatar_url":"https://github.com/tmus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exodus\n\nExodus is a database migration runner for Go. It uses a database-agnostic schema\nDSL to enable you to write database migrations that can be ran against any\nunderlying database.\n\n\u003e Currently, only MySQL is supported. Support for other database drivers is\n\u003e planned. If you want to help out, feel free to send a PR!\n\n## Installation\n\nExodus comes in two parts:\n\n1. It is a library that enables you to write platform agnostic database\n   migrations.\n2. It is a command line program that enables you to run and manage these\n   migrations.\n\nFirstly, you should install the library in your project with\n`go get github.com/tmus/exodus@latest`.\n\nThen, install the command line program with\n`go install github.com/tmus/exodus/cmd/exodus@latest`.\n\n## Usage\n\n### CLI\n\nOnce installed, you can run `exodus help` to get more information on how to use\nthe CLI.\n\n#### `init`\n\nThe `init` command bootstraps a `migrations/` directory in the current working\ndirectory. This will contain a `run.go` file and is where created migrations\nwill live.\n\n\u003e The `run.go` file is generated and should not be edited manually. However,\n\u003e given the fact that this library is a work–in–progress, there may be times\n\u003e that you do need to manually make changes, for example to populate the\n\u003e database credentials and datasource.\n\n#### `create`\n\nThe `create` command will add a new migration file to the directory created by\n`init`. You must pass in a single argument, which will be the name of the\nmigration. The datetime is prepended to this name so that migrations are stored\nin order and are guaranteed to be unique.\n\nFor example `exodus create create_users_table` would yield a new file called\n`20220120211339_create_users_table.go`.\n\nOnce the file is created, you may write migration scripts inside it.\n\n#### `run`\n\nThe `run` command runs the migrations against the database. Any previously ran\nmigrations are not ran again.\n\nThere are two directions that the migrations can run: `up` and `down`, which can\nbe specified as part of the command. If a direction is not provided, `up` is\nassumed.\n\n`up` will run all migrations that have not yet been ran against the database, by\nrunning the `Up` function inside the migration file.\n\n`down` will revert the last \"batch\" of migrations that have been ran, by running\nthe `Down` function inside the migration file.\n\n### Library\n\nTo create a new migration, run `exodus create \u003cmigration_name\u003e`. This will\ncreate a corresponding migration inside the migrations directory.\n\nTwo functions will exist against this migration: `Up` and `Down`, which both\ntake a single argument of `*exodus.MigrationPayload`. You can use this payload\nto register commands to run against the database.\n\nLet's make a `users` table, by calling the `schema.Create` function with a table\nname and a slice of `column.Definition`:\n\n```go\nfunc (migration20220121120254create_users_table) Up(schema *exodus.MigrationPayload) {\n\tschema.Create(\"users\", []column.Definition{})\n}\n```\n\nThis would create an empty table. Let's add some columns. For a `users` table,\nlet's add an incrementing integer for the primary key, as well as an email (that\nneeds to be unique!) and password.\n\n```go\nfunc (migration20220121120254create_users_table) Up(schema *exodus.MigrationPayload) {\n\tschema.Create(\"users\", []column.Definition{\n\t\tcolumn.Increments(\"id\"),\n\t\tcolumn.String(\"email\", 100).Unique(),\n\t\tcolumn.String(\"password\", 255),\n\t})\n}\n```\n\nNotice the `Increments` convenience function and the chained `Unique` call.\nThat'll do for now, but you can check the documentation for a full list of\nsupported column types and modifiers.\n\nWe should write an equivalent `Down` call for this operation. If the `Up` call\ncreates the table, the `Down` call should drop it:\n\n```go\nfunc (migration20220121120254create_users_table) Down(schema *exodus.MigrationPayload) {\n\tschema.Drop(\"users\")\n}\n```\n\nWe're in a good position to run our migrations. `cd` into the `migrations`\ndirectory and run `exodus run up`. You'll get visible feedback that the\nmigrations have ran, or notices of any errors and the reason for failure.\n\nIf all went well, you should be able to check your database and see that the\ntable exists, as well as a record of the migration in the `migrations` table.\n\nTo revert this migration, simply run `exodus run down`, which will revert the\nlast \"batch\" of migrations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmus%2Fexodus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmus%2Fexodus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmus%2Fexodus/lists"}