All Projects → schemalex → Schemalex

schemalex / Schemalex

Licence: mit
Generate difference sql of two mysql schema

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Schemalex

Mysqllog
Lightweight MySQL slow query log parser in Go
Stars: ✭ 29 (-91.85%)
Mutual labels:  parser, mysql
Jsqlparser
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
Stars: ✭ 3,405 (+856.46%)
Mutual labels:  parser, mysql
Sql Parser
A validating SQL lexer and parser with a focus on MySQL dialect.
Stars: ✭ 284 (-20.22%)
Mutual labels:  parser, mysql
Superboot
随着技术日新月异,新技术新平台不断出现,对现如今的开发人员来说选择快速高效的框架进行项目开发,既能提高产出,又能节约时间。本框架无需开发即可实现服务注册、服务发现、负载均衡、服务网关、配置中心、API管理、分布式事务、支撑平台、集成框架、数据传输加密等功能,是学习SpringCloud整体业务模式的完整示例,并且可以直接用于生产环境
Stars: ✭ 341 (-4.21%)
Mutual labels:  mysql
Nameless
NamelessMC is a free, easy to use & powerful website software for your Minecraft server, which includes a large range of features.
Stars: ✭ 337 (-5.34%)
Mutual labels:  mysql
Dormitorymanager
学生宿舍管理系统(SSM/Layui框架;毕业设计)
Stars: ✭ 346 (-2.81%)
Mutual labels:  mysql
Pyhocon
HOCON parser for Python
Stars: ✭ 355 (-0.28%)
Mutual labels:  parser
Sqlsugar
Best ORM Fastest ORM Simple Easy Sqlite orm Oracle ORM Mysql Orm postgresql ORm SqlServer oRm 达梦 ORM 人大金仓 ORM 神通ORM C# ORM
Stars: ✭ 3,748 (+952.81%)
Mutual labels:  mysql
Open source bms
Open Source BMS 后台管理系统
Stars: ✭ 351 (-1.4%)
Mutual labels:  mysql
Mysql Tutorial
🌱 This is a tutorial of MySQL. In this tutorial, you can leran how to use MySQL and optimize SQL.
Stars: ✭ 346 (-2.81%)
Mutual labels:  mysql
Dbngin
DB Engine
Stars: ✭ 344 (-3.37%)
Mutual labels:  mysql
Koa Vue Notes Api
🤓 This is a simple SPA built using Koa as the backend, Vue as the first frontend, and React as the second frontend. Features MySQL integration, user authentication, CRUD note actions, and async/await.
Stars: ✭ 342 (-3.93%)
Mutual labels:  mysql
Php Mysql Class
Simple MySQL class written in PHP, for interfacing with a MySQL database.
Stars: ✭ 349 (-1.97%)
Mutual labels:  mysql
Autoops
linux资产管理,cmdb,django, webssh,运维管理平台,数据库操作平台 本项目已停止开发!因长时间未对代码进行维护,可能会造成项目在不同环境上无法部署、运行BUG等问题,请知晓!项目仅供参考!
Stars: ✭ 340 (-4.49%)
Mutual labels:  mysql
Node Express Passport Mysql
Login Express + Passport + MySQL
Stars: ✭ 349 (-1.97%)
Mutual labels:  mysql
My Love
(都是脑图,建议使用xmind 8 打开)工程师的自我修养 -> 从 linux , 网络,MQ, Rpc, 缓存, 高可用架构,数据库,语言,全方位成长,成为技术大神,优秀的工程师 , readme 包括蚂蚁, 头条, 美团等面试思考( 拿下 offer)
Stars: ✭ 338 (-5.06%)
Mutual labels:  mysql
Bad json parsers
Exposing problems in json parsers of several programming languages.
Stars: ✭ 351 (-1.4%)
Mutual labels:  parser
Exploits
A handy collection of my public exploits, all in one place.
Stars: ✭ 342 (-3.93%)
Mutual labels:  mysql
Offlinemap
基于MySQL + Node.js + Leaflet的离线地图展示,支持百度、谷歌、高德、腾讯地图
Stars: ✭ 343 (-3.65%)
Mutual labels:  mysql
Dokit
基于 Spring Boot2、 Jpa、 Spring Security、JWT、redis、Vue的前后端分离的后台管理系统开发平台, 用户管理、菜单管理、角色管理、字典管理、权限控制的方式为RBAC,操作日志、异常日志、接口限流、项目支持数据权限管理,支持一键生成前后端代码(支持在线预览及打包下载),支持前端菜单动态路由 可一键部署服务器应用,数据库。系统中活跃用户状态监控,监视当前系统CPU、内存、磁盘、堆栈等相关信息,基于Element UI在线表单设计及生成Vue代码。
Stars: ✭ 348 (-2.25%)
Mutual labels:  mysql

schemalex

Generate the difference of two mysql schema

Test

PkgGoDev

SYNOPSIS

This tool can be used to generate the difference, or more precisely, the statements required to migrate from/to, between two MySQL schema.

Suppose you have an existing SQL schema like the following:

CREATE TABLE hoge (
    id INTEGER NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id)
);

And you want "upgrade" your schema to the following:

CREATE TABLE hoge (
    id INTEGER NOT NULL AUTO_INCREMENT,
    c VARCHAR (20) NOT NULL DEFAULT "hoge",
    PRIMARY KEY (id)
);

CREATE TABLE fuga (
    id INTEGER NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id)
);

Using schemalex you can generate a set of commands to perform the migration:

schemalex old.sql new.sql

SET FOREIGN_KEY_CHECKS = 0;

CREATE TABLE `fuga` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
);

ALTER TABLE `hoge` ADD COLUMN `c` VARCHAR (20) NOT NULL DEFAULT "hoge";

SET FOREIGN_KEY_CHECKS = 1;

COMMIT;

You can also use URI formatted strings as the sources to compare, which allow you to compare local files against online schema, a version committed to your git repository against another version, etc.

Please see the help command for a list

schemalex -version
schemalex [options...] before after

-v            Print out the version and exit
-o file	      Output the result to the specified file (default: stdout)
-t[=true]     Enable/Disable transaction in the output (default: true)

"before" and "after" may be a file path, or a URI.
Special URI schemes "mysql" and "local-git" are supported on top of
"file". If the special path "-" is used, it is treated as stdin

Examples:

* Compare local files
  schemalex /path/to/file /another/path/to/file
  schemalex file:///path/to/file /another/path/to/file

* Compare local file against online mysql schema
  schemalex /path/to/file "mysql://user:[email protected](host:port)/dbname?option=value"

* Compare file in local git repository against local file
  schemalex "local-git:///path/to/repo?file=foo.sql&commitish=deadbeaf" /path/to/file

* Compare schema from stdin against local file
	.... | schemalex - /path/to/file

SYNOPSIS (Using the library)

Below is the equivalent of the previous SYNOPSIS.

package schemalex_test

import (
	"os"

	"github.com/schemalex/schemalex/diff"
)

func Example() {
	const sql1 = `CREATE TABLE hoge (
    id INTEGER NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id)
);`
	const sql2 = `CREATE TABLE hoge (
    id INTEGER NOT NULL AUTO_INCREMENT,
    c VARCHAR (20) NOT NULL DEFAULT "hoge",
    PRIMARY KEY (id)
);

CREATE TABLE fuga (
    id INTEGER NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (id)
);`

	diff.Strings(os.Stdout, sql1, sql2, diff.WithTransaction(true))

	// OUTPUT:
	// BEGIN;
	//
	// SET FOREIGN_KEY_CHECKS = 0;
	//
	// CREATE TABLE `fuga` (
	// `id` INTEGER NOT NULL AUTO_INCREMENT,
	// PRIMARY KEY (`id`)
	// );
	//
	// ALTER TABLE `hoge` ADD COLUMN `c` VARCHAR (20) NOT NULL DEFAULT "hoge";
	//
	// SET FOREIGN_KEY_CHECKS = 1;
	//
	// COMMIT;
}

SEE ALSO

LICENSE

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].