Git Product home page Git Product logo

sql-to-jdl's Introduction

Build Status StackShare

sql-to-jdl

Tool to translate SQL databases to JDL format of jHipster (Created due to existing databases to be generated with jHipster and build angular-java web)

Compatibility

This implementation works with mysql 5.7+ and mysql 8+.

Only few changes are required to make it work with oracle db, POSTGRES, etc; Changes should be made on Repository used, probably remove jooq maven generation, use pure SQL with jdbc and have one repository implementation per database type supported then define the appropriate bean based on connection string or other.

Why not use tools like UML provided on jHipster?

  • JDL from web is ok for a few entities but not for more than 100 entities and relations
  • UML software and xml exporters could have worked (other tools on jHipster) but:
    • already many databases in production to be exported in JDL (faster to generate the JDL from it)
    • already working UML design with MySQL Workbench

An alternative for REST filter and sort

Different criterias, support for JPA and jOOQ dynamic filtering and sorting

https://github.com/Blackdread/rest-filter

How to use

Run "mvn compile" at least once to let jOOQ generate some required tables (see Issue solved). I have removed generated code, it is directly part of the codebase.

Just execute the code from IDE or use "mvn" to run the code, it will connect to your DB (see application config yml) and it will generate the JDL.

Set properties file:

  • Schema name to export
  • Tables names to be ignored
  • Path of export file

After JDL file is generated

Still have some manual steps to do:

  • review relations:
    • ManyToMany
    • Owner side display field
    • Inverse side field name and display field
    • Bidirectional or not
  • add values to enums
  • review validations of entities

Use of

  • jOOQ
  • Spring boot

Default specific rules

Table is treated as enum if only 2 columns and both are: "id" AND ("code" OR "name")

Table is treated as ManyToMany if only 2 columns and both are foreign keys

Links

jHipster JDL

sql-to-jdl's People

Contributors

blackdread avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar duttonw avatar krmahadevan avatar linuxidefix avatar murillocg avatar octgsoftware avatar

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.