{"id":37209441,"url":"https://github.com/lushdigital/modelgen","last_synced_at":"2026-01-15T00:00:56.768Z","repository":{"id":57502031,"uuid":"112190915","full_name":"LUSHDigital/modelgen","owner":"LUSHDigital","description":"Generate models from reading your database","archived":false,"fork":false,"pushed_at":"2018-10-24T15:12:44.000Z","size":3299,"stargazers_count":85,"open_issues_count":0,"forks_count":9,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-19T10:13:19.816Z","etag":null,"topics":["database","go","golang","modelgen"],"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/LUSHDigital.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":"2017-11-27T12:00:36.000Z","updated_at":"2024-09-13T18:50:57.000Z","dependencies_parsed_at":"2022-09-13T07:24:57.234Z","dependency_job_id":null,"html_url":"https://github.com/LUSHDigital/modelgen","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/LUSHDigital/modelgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUSHDigital%2Fmodelgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUSHDigital%2Fmodelgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUSHDigital%2Fmodelgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUSHDigital%2Fmodelgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LUSHDigital","download_url":"https://codeload.github.com/LUSHDigital/modelgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUSHDigital%2Fmodelgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28439605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"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","golang","modelgen"],"created_at":"2026-01-15T00:00:31.067Z","updated_at":"2026-01-15T00:00:56.744Z","avatar_url":"https://github.com/LUSHDigital.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modelgen [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/LUSHDigital/modelgen/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/LUSHDigital/modelgen)](https://goreportcard.com/report/github.com/LUSHDigital/modelgen) [![Build Status](https://travis-ci.org/LUSHDigital/modelgen.svg?branch=master)](https://travis-ci.org/LUSHDigital/modelgen)\n\nModelgen generates working database interaction code from reading your MySQL / MariaDB database.\n\n## Install:\n\n```bash\nbrew tap lushdigital/tools\nbrew install modelgen\n```\n\nThis will install `modelgen` under `/usr/local/bin`.\n\nIf you want to uninstall it, simply delete it, or run `brew uninstall modelgen`\n\n## Conventions:\n\n`modelgen` assumes your database will follow a couple conventions:\n\n- tables must have a primary key `id` field\n- column names must not collide with a valid Go type, ex: string\n\nThe primary `id` doesn't need to auto-increment, though it is recommended.\n\n## Ordering:\n\nIn cases where you want the migrations to be generated in a particular order (ex. because of foreign key constraints)\nyou can control this by simply adding a comment to your `id` field.\n\nThis format must take the following format:\n\n```\n# for example a the user table id has the comment:\nmodelgen:1\n\n# then the user_post table id has the comment:\nmodelgen:2\n\n```\n\nby doing so you ensure that the `user` table always gets migrated before the `user_post` table.\n\n## Usage:\n\n```\nUsage:\n   [command]\n\nAvailable Commands:\n  generate    Generate models from a database connection\n  help        Help about any command\n  migrate     Generate migration files from a database connection\n\nFlags:\n  -c, --connection string   user:pass@host:port\n  -d, --database string     name of database\n  -h, --help                help for this command\n  -o, --output string       path to package (default \"generated_models\")\n  -p, --package string      name of package (default \"generated_models\")\n\nExample:\n\n# Create models\nmodelgen generate -c root:pass@localhost:3306 -d my-db -o models\n\n# Create migrations\nmodelgen migrate -c root:pass@localhost:3306 -d my-db -o migrations\n```\n\n## Visual Aid:\n\n![visual.svg](./visual.svg)\n\n## Credit:\n\nModelgen is built using the following amazing libraries:\n\n- [github.com/spf13/cobra](https://github.com/spf13/cobra)\n- [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flushdigital%2Fmodelgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flushdigital%2Fmodelgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flushdigital%2Fmodelgen/lists"}