GithubHelp home page GithubHelp logo

drinkjava2 / jdialects Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 11.0 1.43 MB

jDialects is a database dialect tool

Home Page: https://gitee.com/drinkjava2/jdialects

License: Apache License 2.0

Java 100.00% Batchfile 0.01%

jdialects's People

Contributors

dependabot[bot] avatar drinkjava2 avatar jingwenlqh avatar liu-junlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jdialects's Issues

生成ddl的字段长度存在问题

重现步骤

1. 在mysql数据库中创建表

create table test
(
    nc char(100) charset utf8 null,
    nvc varchar(100) charset utf8 null,
    c char(100) null,
    vc varchar(100) null,
    i int(10) null,
    bi bigint null,
    si smallint null,
    ti tinyint null
)

2. 执行如下代码

    Dialect dialect = Dialect.MySQL8Dialect;
    // 获取连接
    Connection connection = getConnection();
    TableModel[] tableModels = TableModelUtils.db2Models(connection, dialect);
    TableModel tableModel = tableModels[0];
    String[] ddl = dialect .toCreateDDL(tableModel);
    System.out.println(ddl[0]);

输出如下:

create table test
( 
nc char(300),
nvc varchar(300),
c char(400),
vc varchar(400),
i integer,
bi bigint(0),
si smallint(0),
ti tinyint(0)
) engine=InnoDB;

可以看到字段的长度被放大了

原因

解析字段的时候使用了CHAR_OCTET_LENGTH作为columnLength,生成ddl的时候也是用的这个,但是实际上mysql很多字段使用的都是COLUMN_SIZE

cascade not supported

db ddl have cascade feature,would you like to support it?you can check it from ddlutils docs or mysql grammer

Why ignore some version

Some db version like MySQL5Dialect,MySQL55Dialect,MySQL57Dialect and MySQL8Dialect.
If I use MySQL56, which dialect should i choose? Does it backward compatible as I use MySQL57Dialect?

toAddColumnDDL丢失了comment

TableModel tb = new TableModel("test");
String[] add = Dialect.PostgreSQLDialect.toAddColumnDDL(tb.column("name").STRING(50).comment("名称"));

version: 5.0.13.jre8

unique constraint create error

a table can have a unique constraint with more than 1 column . but it will output unique constraint for each column. it should output one constraint with all column which have same constraint name. and a column can be used by 2 unique constraint too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.