Comments (5)
I do not understand, can you show UML/example?
from sql-to-jdl.
see sql tables (users, locations and user_locations) below
CREATE TABLE users (
id int(11) NOT NULL,
full_name VARCHAR(100) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE locations (
id int(11) NOT NULL,
street varchar(30) NOT NULL,
city varchar(30) NOT NULL,
state varchar(30) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE users_locations (
user_id INT,
location_id INT,
CONSTRAINT user_add_pk PRIMARY KEY (user_id, location_id),
CONSTRAINT FK_user FOREIGN KEY (user_id) REFERENCES users (id),
CONSTRAINT FK_location FOREIGN KEY (location_id) REFERENCES locations (id)
);
but generated jdl as
entity Locations(locations) {
id Integer required,
street String required maxlength(30),
city String required maxlength(30),
state String required maxlength(30)
}
entity Users(users) {
id Integer required,
fullName String required maxlength(100),
}
// Relations
// TODO This is a pure ManyToMany relation (delete me and decide owner side)
relationship ManyToMany {
UsersLocations{user required} to Users{usersLocations}
}
// TODO This is a pure ManyToMany relation (delete me and decide owner side)
relationship ManyToMany {
UsersLocations{location required} to Locations{usersLocations}
}
it omits bridge table (connecting table) if table has only foreign keys. You have also mentioned in readme so my question is in this regard that can we enforce to generate this bridge table entity.
one thing if we add 3rd column in bridge table it will generate entity.
from sql-to-jdl.
As I understand, this a feature request for forcing an entity creation of UsersLocations
and have 2 ManyToOne relations defined, am I correct?
I see the feature configuration could be:
- Add boolean to specify if force all ManyToMany as 2 ManyToOne (default is false) and generate entities
- Add list of table names to override default for specified tables to force ManyToMany as 2 ManyToOne and make those tables as entities
As you have noted, adding an extra column in users_locations
will not consider that table as a ManyToMany which is correct current behaviour.
If you want to add that feature, please follow on above requirements given.
from sql-to-jdl.
you are right.
from sql-to-jdl.
I have a bit of the opposite situation in a database I am working on. There is a table with two foreign key columns, but also has an updated and created timestamp that are set with a database trigger. In this case I want it to be considered a ManyToMany, but it is treated as a separate entity. I will look into this if I get around to handling my situation.
from sql-to-jdl.
Related Issues (20)
- Convert MySQL cod to use SQL instead of jOOQ HOT 1
- Add support for best guess for relationship display fields HOT 2
- Add support for MsSQL Server
- Add support for Oracle HOT 1
- Add husky git hook to format code before commit HOT 1
- Use Mustache.java to render JDL HOT 2
- Add Lombok to reduce boilerplate code and add a builder pattern HOT 3
- Add ability to disable adding options to the generated JDL HOT 1
- Fix unsupported char in filename for windows HOT 1
- In relation, project generate relation unique key instead primary. HOT 3
- Fix a bug 'relationship name is not synchronized' HOT 5
- Add query to fetch values of enums
- Can't use with Postgresql 15.1 HOT 9
- JdlViewMapperImpl is missing in repo HOT 1
- Getting this error when I run sql-to-jdl HOT 1
- Failed to bind properties under 'application' HOT 1
- Handle reflexive relationships
- Honour the unique attribute for a column
- The elements [application.table-to-export] were left unbound HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sql-to-jdl.