All Projects → dev-cloverlab → carpenter

dev-cloverlab / carpenter

Licence: MIT License
Carpenter is a tool to manage DB schema and data

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to carpenter

Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+5546.34%)
Mutual labels:  migration, mariadb
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 7,712 (+18709.76%)
Mutual labels:  migration, mariadb
Evolve
Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
Stars: ✭ 477 (+1063.41%)
Mutual labels:  migration, mariadb
r2dbc-migrate
R2DBC database migration tool & library
Stars: ✭ 83 (+102.44%)
Mutual labels:  migration, mariadb
dockerX
Examples of amazing Docker/Docker-Compose/Docker Swarm technologies
Stars: ✭ 17 (-58.54%)
Mutual labels:  mariadb
docker-symfony
Docker Symfony (PHP-FPM - NGINX - MySQL - MailHog - Redis - RabbitMQ)
Stars: ✭ 32 (-21.95%)
Mutual labels:  mariadb
mgmigrate
mgmigrate is a tool for migrating data from MySQL or PostgreSQL to Memgraph and between Memgraph instances.
Stars: ✭ 17 (-58.54%)
Mutual labels:  migration
database connections
⚙️Demonstration code to connect R on MacOS to various database flavors.
Stars: ✭ 18 (-56.1%)
Mutual labels:  mariadb
laravel-online-migrator
Apply Laravel's database migrations with minimal disruptions using tools like Percona Online Schema Change
Stars: ✭ 43 (+4.88%)
Mutual labels:  migration
illuminate
Yii2 to Laravel Migration Package
Stars: ✭ 71 (+73.17%)
Mutual labels:  migration
mysql-to-laravel-migration
Generate Laravel migration files from SQL
Stars: ✭ 18 (-56.1%)
Mutual labels:  mariadb
trona
Write DB migrations with SQL and run them with a CLI
Stars: ✭ 31 (-24.39%)
Mutual labels:  migration
thinkorm
A flexible, lightweight and powerful Object-Relational Mapper for Node.js. Support TypeScript!!
Stars: ✭ 33 (-19.51%)
Mutual labels:  mariadb
rails async migrations
Asynchronous support for ActiveRecord::Migration
Stars: ✭ 56 (+36.59%)
Mutual labels:  migration
loopback-component-migrate
Migration framework for loopback
Stars: ✭ 43 (+4.88%)
Mutual labels:  migration
maildir2gmail
Maildir 2 Gmail
Stars: ✭ 14 (-65.85%)
Mutual labels:  migration
database
Aplus Framework Database Library
Stars: ✭ 147 (+258.54%)
Mutual labels:  mariadb
zenit
Zenit is a daemon collector for metrics and log parsers for any MySQL variant and ProxySQL
Stars: ✭ 24 (-41.46%)
Mutual labels:  mariadb
fastfreeze
Turn-key solution to checkpoint/restore applications running in Linux containers
Stars: ✭ 68 (+65.85%)
Mutual labels:  migration
typetta
Node.js ORM written in TypeScript for type lovers.
Stars: ✭ 44 (+7.32%)
Mutual labels:  mariadb

carpenter

GitHub release license

carpenter is a tool to manage DB schema and data inspired by naoina/migu.
By using this, you can manage the database structures and data as text (JSON, CSV).  carpenter can restore the database structure and data from text, or can export them to text in easy.

supported databases are MySQL|MariaDB only currently

Install

% brew tap dev-cloverlab/carpenter
% brew install carpenter

for Gophers.

% go get -u github.com/dev-cloverlab/carpenter

How to use

carpenter has four simple commands are classified database structure and data. For each command is also available to use as indivisually.

Commands for structure

design

design command can export database structure as JSON. By doing below, exports JSON file named table.json to current directory.

% carpenter -s test -d "root:@tcp(127.0.0.1:3306)" design -d ./

When you want to separate files for each tables, you can set -s option.

options:

  • -s export JSON files are separated for each table (default off)
  • -p pretty output (default off)
  • -d export directory path

Each option has alternative long name. Please see the help for details.

build

build command can restore database structure from JSON files. By doing below, generate the difference SQLs between tables and JSON files and execute them.

% carpenter -s test -d "root:@tcp(127.0.0.1:3306)" build -d .

When you want to just show the generated SQLs, you can set --dry-run global option.

Commands for data

export

export command can export data as CSV files. By doing below, export data as CSV files for each table.

% carpenter -s test -d "root:@tcp(127.0.0.1:3306)" export -d .

When you want to select exporting tables, you can set regular expression to -r option like below.

% carpenter -s test -d "root:@tcp(127.0.0.1:3306)" export -r "^master_*$" -d .

import

import command can import CSV files to tables. By doing below, generate the difference SQLs between tables and CSV files and execute them.

% carpenter -s test -d "root:@tcp(127.0.0.1:3306)" import -d .

When you want to just show the generated SQLs, you can set --dry-run global option.

Architecture

Explain how carpenter syncronizes text and database.

MySQL(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.

For example:

// about member table

// database
+-------+--------------+------+
| Field | Type         | Null |
+-------+--------------+------+
| name  | varchar(255) | NO   |
| email | varchar(255) | NO   |
+-------+--------------+------+

// file
+--------+--------------+------+
| Field  | Type         | Null |
+--------+--------------+------+
| name   | varchar(255) | NO   |
| email  | varchar(255) | NO   |
| gender | tinyint(4)   | NO   |
+--------+--------------+------+

To generate this.

alter table `member` add `gender` tinyint(4) not null after `email`

carpenter can generate SQLs at various scenes like:

  • CREATE
  • DROP
  • ALTER
  • INSERT
  • REPLACE
  • DELETE

These SQLs are generated by difference of both information structs.

Contribution

  1. Fork (https://github.com/dev-cloverlab/carpenter/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Author

@hatajoe

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].