{"id":34120668,"url":"https://github.com/dev-cloverlab/carpenter","last_synced_at":"2026-05-26T21:32:27.039Z","repository":{"id":57523465,"uuid":"73872068","full_name":"dev-cloverlab/carpenter","owner":"dev-cloverlab","description":"Carpenter is a tool to manage DB schema and data","archived":false,"fork":false,"pushed_at":"2019-05-21T14:48:05.000Z","size":86,"stargazers_count":42,"open_issues_count":1,"forks_count":8,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-12-17T07:12:54.104Z","etag":null,"topics":["cli","go","mariadb","migration","mysql"],"latest_commit_sha":null,"homepage":null,"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/dev-cloverlab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-11-16T01:40:09.000Z","updated_at":"2025-02-24T11:33:04.000Z","dependencies_parsed_at":"2022-08-28T11:12:25.547Z","dependency_job_id":null,"html_url":"https://github.com/dev-cloverlab/carpenter","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/dev-cloverlab/carpenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cloverlab%2Fcarpenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cloverlab%2Fcarpenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cloverlab%2Fcarpenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cloverlab%2Fcarpenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-cloverlab","download_url":"https://codeload.github.com/dev-cloverlab/carpenter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cloverlab%2Fcarpenter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33540614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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","go","mariadb","migration","mysql"],"created_at":"2025-12-14T21:32:25.204Z","updated_at":"2026-05-26T21:32:27.031Z","avatar_url":"https://github.com/dev-cloverlab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# carpenter\n\n[![GitHub release](https://img.shields.io/github/release/dev-cloverlab/carpenter.svg?style=flat-square)](https://github.com/dev-cloverlab/carpenter)\n[![license](https://img.shields.io/github/license/dev-cloverlab/carpenter.svg?style=flat-square)](https://github.com/dev-cloverlab/carpenter)\n\ncarpenter is a tool to manage DB schema and data inspired by [naoina/migu](https://github.com/naoina/migu).  \nBy using this, you can manage the database structures and data as text (JSON, CSV). \ncarpenter can restore the database structure and data from text, or can export them to text in easy.  \n\n**supported databases are MySQL|MariaDB only currently**\n\n## Install\n\n```\n% brew tap dev-cloverlab/carpenter\n% brew install carpenter\n```\n\nfor Gophers.\n\n```\n% go get -u github.com/dev-cloverlab/carpenter\n```\n\n# How to use\n\ncarpenter has four simple commands are classified database `structure` and `data`. For each command is also available to use as indivisually.\n\n## Commands for structure\n\n### design \n\n`design` command can export database structure as JSON. By doing below, exports JSON file named `table.json` to current directory.\n\n```\n% carpenter -s test -d \"root:@tcp(127.0.0.1:3306)\" design -d ./\n```\n\nWhen you want to separate files for each tables, you can set `-s` option.  \n\noptions:\n\n- `-s` export JSON files are separated for each table (default off)\n- `-p` pretty output (default off)\n- `-d` export directory path\n\nEach option has alternative long name. Please see the help for details.\n\n### build\n\n`build` command can restore database structure from JSON files. By doing below, generate the difference SQLs between tables and JSON files and execute them.\n\n```\n% carpenter -s test -d \"root:@tcp(127.0.0.1:3306)\" build -d .\n```\n\nWhen you want to just show the generated SQLs, you can set `--dry-run` global option.\n\n## Commands for data\n\n### export\n\n`export` command can export data as CSV files. By doing below, export data as CSV files for each table.\n\n```\n% carpenter -s test -d \"root:@tcp(127.0.0.1:3306)\" export -d .\n```\n\nWhen you want to select exporting tables, you can set regular expression to `-r` option like below.\n\n```\n% carpenter -s test -d \"root:@tcp(127.0.0.1:3306)\" export -r \"^master_*$\" -d .\n```\n\n### import\n\n`import` command can import CSV files to tables. By doing below, generate the difference SQLs between tables and CSV files and execute them.\n\n```\n% carpenter -s test -d \"root:@tcp(127.0.0.1:3306)\" import -d .\n```\n\nWhen you want to just show the generated SQLs, you can set `--dry-run` global option.\n\n## Architecture\n\nExplain how carpenter syncronizes text and database.  \n\nMySQL(MariaDB) has information table that has table, column, index and partition information. carpenter refers that and translate it to JSON, and unmarshal it to struct. Both of structs that are made from database and files can compare each field type and etc. When some difference are found for each field, carpenter generates SQLs for resolve differences.\n\nFor example:\n\n```\n// about member table\n\n// database\n+-------+--------------+------+\n| Field | Type         | Null |\n+-------+--------------+------+\n| name  | varchar(255) | NO   |\n| email | varchar(255) | NO   |\n+-------+--------------+------+\n\n// file\n+--------+--------------+------+\n| Field  | Type         | Null |\n+--------+--------------+------+\n| name   | varchar(255) | NO   |\n| email  | varchar(255) | NO   |\n| gender | tinyint(4)   | NO   |\n+--------+--------------+------+\n```\n\nTo generate this.\n\n```sql\nalter table `member` add `gender` tinyint(4) not null after `email`\n```\n\ncarpenter can generate SQLs at various scenes like:\n\n- CREATE\n- DROP\n- ALTER\n- INSERT\n- REPLACE\n- DELETE\n\nThese SQLs are generated by difference of both information structs.\n\n## Contribution\n\n1. Fork ([https://github.com/dev-cloverlab/carpenter/fork](https://github.com/dev-cloverlab/carpenter/fork))\n1. Create a feature branch\n1. Commit your changes\n1. Rebase your local changes against the master branch\n1. Run test suite with the `go test ./...` command and confirm that it passes\n1. Run `gofmt -s`\n1. Create a new Pull Request\n\n## Author\n\n[@hatajoe](https://twitter.com/hatajoe)\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-cloverlab%2Fcarpenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev-cloverlab%2Fcarpenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-cloverlab%2Fcarpenter/lists"}