Skip to content

convert mysql DDL to other db, like postgresql/gaussdb/oracle.

License

Notifications You must be signed in to change notification settings

sineycoder/csql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSQL

Convert mysql db ddl to other db ddl.

Support

Only support following db type:

  • postgresql
  • postgresql-compatible (< postgresql 9.4)
  • oracle(not support current)

Usage

  • cmd
# build csql
go build -o csql

csql -o <filepath> <sqlfile>

# select db type that you want to convert.
? Select db type you want to convert to: 
  ▸ postgresql-compatible
    postgresql
# result will be saved to <filepath>

# TODO: print result if without -o
  • import
import (
    "github.com/sineycoder/csql/sql/mysql"
)

func main() {
    res, err := mysql.ParseSQLToString("your mysql sql", mysql.PostgresqlCompatible)
    if err != nil {
        panic(err)
    }
}

Example

CREATE TABLE `test` (
  `id` int(11) NOT NULL

About

convert mysql DDL to other db, like postgresql/gaussdb/oracle.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages