{"id":37100649,"url":"https://github.com/akfaiz/migris","last_synced_at":"2026-05-02T13:04:52.584Z","repository":{"id":301706542,"uuid":"1010055228","full_name":"akfaiz/migris","owner":"akfaiz","description":"Database migration library for Go with fluent schema builder and multi-database support","archived":false,"fork":false,"pushed_at":"2026-05-02T04:06:13.000Z","size":199,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-02T06:16:47.705Z","etag":null,"topics":["database","go","go-migration","hacktoberfest","migrations"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/akfaiz/migris","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/akfaiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-28T08:44:36.000Z","updated_at":"2026-05-02T04:06:14.000Z","dependencies_parsed_at":"2025-06-28T10:34:37.673Z","dependency_job_id":"3fee1ec8-5fd9-4b3a-8688-fbea5e35ade1","html_url":"https://github.com/akfaiz/migris","commit_stats":null,"previous_names":["ahmadfaizk/schema","afkdevs/go-schema"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/akfaiz/migris","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akfaiz%2Fmigris","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akfaiz%2Fmigris/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akfaiz%2Fmigris/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akfaiz%2Fmigris/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akfaiz","download_url":"https://codeload.github.com/akfaiz/migris/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akfaiz%2Fmigris/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32534975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: 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","go-migration","hacktoberfest","migrations"],"created_at":"2026-01-14T12:15:11.421Z","updated_at":"2026-05-02T13:04:52.579Z","avatar_url":"https://github.com/akfaiz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migris\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/akfaiz/migris.svg)](https://pkg.go.dev/github.com/akfaiz/migris)\n[![Go Report Card](https://goreportcard.com/badge/github.com/akfaiz/migris)](https://goreportcard.com/report/github.com/akfaiz/migris)\n[![codecov](https://codecov.io/gh/akfaiz/migris/graph/badge.svg?token=7tbSVRaD4b)](https://codecov.io/gh/akfaiz/migris)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/akfaiz/migris/blob/main/LICENSE)\n\n**Migris** is a database migration library for Go, inspired by Laravel's migrations. It combines the power of [pressly/goose](https://github.com/pressly/goose) with a fluent schema builder, making migrations easy to write, run, and maintain.\n\n## Features\n\n- **Migration management** - Run up, down, reset, status, and create operations\n- **Dry-run mode** - Preview migrations without executing them to see generated SQL\n- **Fluent schema builder** - Laravel-inspired API for defining database schemas\n- **Multi-database support** - Works with PostgreSQL, MySQL, MariaDB, and SQLite3\n- **Transaction safety** - All migrations run within database transactions\n- **Native Go integration** - No external CLI tools required\n\n## Installation\n\n```bash\ngo get -u github.com/akfaiz/migris\n```\n\n## Quick Start\n\n### Creating Migrations\n\nDefine migrations using the fluent schema builder API:\n\n```go\npackage migrations\n\nimport (\n    \"github.com/akfaiz/migris\"\n    \"github.com/akfaiz/migris/schema\"\n)\n\nfunc init() {\n    migris.AddMigrationContext(upCreateUsersTable, downCreateUsersTable)\n}\n\nfunc upCreateUsersTable(c schema.Context) error {\n    return schema.Create(c, \"users\", func(table *schema.Blueprint) {\n        table.ID()\n        table.String(\"name\")\n        table.String(\"email\").Unique()\n        table.Timestamp(\"email_verified_at\").Nullable()\n        table.String(\"password\")\n        table.Timestamps()\n    })\n}\n\nfunc downCreateUsersTable(c schema.Context) error {\n    return schema.DropIfExists(c, \"users\")\n}\n```\n\n### Running Migrations\n\nFor a complete CLI setup example, see [examples/basic](examples/basic/). For quick setup, use the CLI helpers below.\n\n### CLI Helpers\n\nFor simpler CLI integration, use the pre-built CLI helpers:\n\n#### Using urfave/cli\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"database/sql\"\n    \"log\"\n    \"os\"\n\n    \"github.com/akfaiz/migris/extra/migriscli\"\n    _ \"github.com/jackc/pgx/v5/stdlib\"\n)\n\nfunc main() {\n    db, err := sql.Open(\"pgx\", os.Getenv(\"DATABASE_URL\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer db.Close()\n\n    cfg := migriscli.Config{\n        DB:            db,\n        Dialect:       \"pgx\",\n        MigrationsDir: \"./migrations\",\n    }\n\n    cmd := migriscli.NewCLI(cfg)\n    if err := cmd.Run(context.Background(), os.Args); err != nil {\n        log.Fatal(err)\n    }\n}\n```\n\n#### Using Cobra\n\n```go\npackage main\n\nimport (\n    \"database/sql\"\n    \"log\"\n    \"os\"\n\n    \"github.com/akfaiz/migris/extra/migriscobra\"\n    _ \"github.com/jackc/pgx/v5/stdlib\"\n)\n\nfunc main() {\n    db, err := sql.Open(\"pgx\", os.Getenv(\"DATABASE_URL\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer db.Close()\n\n    cfg := migriscobra.Config{\n        DB:            db,\n        Dialect:       \"pgx\",\n        MigrationsDir: \"./migrations\",\n    }\n\n    cmd := migriscobra.NewCLI(cfg)\n    if err := cmd.Execute(); err != nil {\n        log.Fatal(err)\n    }\n}\n```\n\nBoth CLI helpers support all migration commands: `create`, `up`, `up-to`, `down`, `down-to`, `reset`, `status` with `--dry-run` support.\n\n## Schema Builder API\n\nThe schema builder provides a fluent interface for defining database schemas:\n\n```go\n// Creating tables\nschema.Create(c, \"posts\", func(table *schema.Blueprint) {\n    table.ID()\n    table.String(\"title\")\n    table.Text(\"content\")\n    table.UnsignedBigInteger(\"user_id\")\n    table.Boolean(\"published\").Default(false)\n    table.Timestamps()\n\n    // Foreign key constraints\n    table.Foreign(\"user_id\").References(\"id\").On(\"users\")\n\n    // Indexes\n    table.Index([]string{\"title\", \"published\"})\n})\n\n// Modifying existing tables\nschema.Table(c, \"posts\", func(table *schema.Blueprint) {\n    table.String(\"slug\")\n    table.DropColumn(\"old_column\")\n})\n```\n\n## Migration Operations\n\nMigris supports all standard migration operations:\n\n```go\nmigrator.Up()           // Run all pending migrations\nmigrator.Down()         // Rollback the last migration\nmigrator.Reset()        // Rollback all migrations\nmigrator.Status()       // Show migration status\nmigrator.Create(name)   // Create a new migration file\n```\n\n### Dry-Run Mode\n\nPreview migrations without executing them:\n\n```bash\n# Preview pending migrations\ngo run main.go --dry-run up\n\n# Preview rollback operations\ngo run main.go --dry-run down\ngo run main.go --dry-run reset\n```\n\nDry-run mode shows:\n\n- Which migrations would be executed\n- The exact SQL statements that would be generated\n- Execution timing and summary statistics\n- Clear indication that no database changes are made\n\n## Database Support\n\nCurrently supported databases:\n\n- **PostgreSQL** (via pgx driver)\n- **MySQL**\n- **MariaDB**\n- **SQLite3**\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues, feature requests, or pull requests.\n\n## License\n\nReleased under the MIT License. See [LICENSE](./LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakfaiz%2Fmigris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakfaiz%2Fmigris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakfaiz%2Fmigris/lists"}