Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add database diagrams#1962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
MKleusberg wants to merge13 commits intomaster
base:master
Choose a base branch
Loading
from0xd800-diagrams
Draft

Add database diagrams#1962

MKleusberg wants to merge13 commits intomasterfrom0xd800-diagrams

Conversation

MKleusberg
Copy link
Member

See#1961. This is a copy in our local branch. I have adjusted it to get it to compile and added some missing pieces. However, none of the actual drawing code seems to be there, so you don't see anything. Not sure how much work is needed there. Is anybody interested in finishing this?

justinclift, mbraeutigam, data-man, isghe, TaQuangKhoi, mgramin, and i0tool5 reacted with thumbs up emojidata-man, boruok, i0tool5, rudrOwO, and flywire reacted with rocket emoji
vtronkoand others added9 commitsDecember 29, 2016 07:58
This model represents the list of available db tables.They can be dragged onto diagram. Tables, that arealready displayed on diagram, are greyed out and can't be dragged.
Tables represent database tables, and Relations represent foreign keyconstraints.
This is just a naive scene interface implementation.Items can't be resized or moved, or dropped onto it. It'scoming soon©
We use subclassed proxy widget, that overrides overridden mouse event methodsand just returns default scene mouse events.
Use contextual menu of  DB Schema dock to add tables to diagram.This might make redundant the current table list internal to the scene.
@mgrojo
Copy link
Member

mgrojo commentedAug 12, 2019
edited
Loading

I've taken a look to this.

I made a quick change to add the tables to the diagram.

imagen

This is the list of implemented work so far:

  • Adding tables to diagram
  • Tables displays table name and fields with icons (PK and regular field)
  • Moving around the tables in the diagram

Pending minimal work:

  • Displaying icon for foreign keys
  • Resizing tables (manually)
  • Resizing tables to fit content
  • Drawing references between tables
  • Saving diagram in project file
  • Deleting tables from the diagram

Items to be discussed:

  • Adding tables using the DB Schema dock (just implemented) or through the embedded table list (initial approach).
  • Raising and lowering tables? Maybe it's enough if the table is raised when clicked/moved.
  • Currently if a table is added twice to the diagram, two instances appear. Do we want this?
  • Has the "Database Diagram" be open by default? I think so. It has to be added to restoreOpenTabs, then.
  • Should the tab be named "Database Diagram"? I'd drop "Database", as self-evident. I'd do it also for "Database Structure", by the way.

Features that would be nice to have, but not essential:

  • Adding tables by dropping them from the dock to the desired position in the scene
  • Printing
  • Automatic placement of new tables in diagrams
  • Automatic layout for adding all tables to the diagram (easier if we solve the previous point)
  • Editing table and field names and references

This would implement#913 and#1260

justinclift, MKleusberg, and anibalcortesse reacted with thumbs up emoji

@justinclift
Copy link
Member

justinclift commentedAug 14, 2019
edited
Loading

@schdub Ping. Just in case this is still an area of interest for you. 😄

Reduce diagram tables width using the size hint of the table name label.
@MKleusberg
Copy link
MemberAuthor

Awesome! This looks already much better than I dared to imagine 👍

Adding tables using the DB Schema dock (just implemented) or through the embedded table list (initial approach).

I fully agree with your approach here. I guess the embedded list was just there because the code is quite old and we probably didn't have the schema dock back then.

Has the "Database Diagram" be open by default? I think so. It has to be added to restoreOpenTabs, then.

Makes sense. I just forgot to add it torestoreOpenTabs when rebasing the code. No intention there 😄

Should the tab be named "Database Diagram"? I'd drop "Database", as self-evident. I'd do it also for "Database Structure", by the way.

Probably yes. As for the "Database Structure": It does make sense but I'm not sure how habit-breaking it would be for long time users. That said, we have all these issues regarding multiple instances of the Browse Data tab and I have just started working on this. It's probably going to take a long time until we have this actually working but when we add this one day it's probably a good time to rename the old tabs as we like.

@chrisjlocke
Copy link
Member

chrisjlocke commentedAug 21, 2019 via email

Should the tab be named "Database Diagram"?
Graphical schema? Titular Thankful Tabular Table View? DiagramaticalSchematicy Thingy?

@justinclift
Copy link
Member

From memory, the "official" name used for these kind of things is Entity Relationship Diagram (ERD). eg a diagram of theEntity Relationship Model

That being said, it's probably not the right term to choose as almost no-one would know what it means. 😉

@chrisjlocke
Copy link
Member

chrisjlocke commentedAug 22, 2019 via email
edited by justinclift
Loading

So I was close then..... ;)
justinclift reacted with laugh emoji

@SilvioGrosso
Copy link

From memory, the "official" name used for these kind of things is Entity Relationship Diagram (ERD). eg a diagram of the Entity Relationship Model

Sure :-)

If you wish to get some inspiration you can also take a look at how DBeaver (open source Java software) has implemented this same feature:
https://github.com/dbeaver/dbeaver/wiki/ER-Diagrams

flywire reacted with thumbs up emoji

@mgrojomgrojo self-assigned thisSep 7, 2019
When a new table is added to the diagram, its relations to parent andchild tables are added too. The lines connecting the tables have start andend positions based on the table proxies representing the table in thediagram.When the tables are moved, their relation lines are moved too.
@scottfurry
Copy link
Contributor

The purpose of "Show tables lists"? A userwould expect to click/right click/drag a table from that list onto the diagram pane. Doesn't work. Knowing to select a table from "DB Schema" seems counter intuitive and makes the "Show tables list" redundant/waste of space.

The "table magnet" action going on is painful. Selecting a table and moving it around causes another table on the display to be "repelled" to a new location. I can see users getting ticked at this "feature".

One thing that would be "nice", harkening back to my MSAccess days, would be to generate "automagically" the diagram from the structure of an existing database.

This then begs the question...have we accounted for the one-to-one, one-to-many, many-to-one, and many-to-many type relationships that can exist between tables?

This needs work...

@mgrojo
Copy link
Member

The purpose of "Show tables lists"? A userwould expect to click/right click/drag a table from that list onto the diagram pane. Doesn't work. Knowing to select a table from "DB Schema" seems counter intuitive and makes the "Show tables list" redundant/waste of space.

Yes, it would be redundant. "Show tables lists" was the idea of the original author, but now with the Schema dock, it makes more sense to add the tables from there. For making the action more intuitive, I'd add a message to diagram scene when it's empty:

"Add tables to this diagram by dragging and dropping them or using the contextual menu from the "DB Schema" dock"

When the first table is added, the message will be deleted.

The "table magnet" action going on is painful. Selecting a table and moving it around causes another table on the display to be "repelled" to a new location. I can see users getting ticked at this "feature".

There isn't any magnet if I understand what you mean by that correctly. The question is: the scene has an initial dimension equal to the panel, when you move a table outside of that frame, the scene grows and the center of the canvas moves. This might give the impression that the other tables are moving, but in fact it's the scene view what is moving.

One thing that would be "nice", harkening back to my MSAccess days, would be to generate "automagically" the diagram from the structure of an existing database.

Would be easy if we know how to layout the tables correctly. An initial vesion could simply add them in a grid layout independently of the relations they have: so the relation lines could form a mesh, but would be a start.

This then begs the question...have we accounted for the one-to-one, one-to-many, many-to-one, and many-to-many type relationships that can exist between tables?

That is used by MS Access for automatically generating queries, isn't it? Since we are not currently generating any query on behalf of the user, relations different to the established by the foreign key constraint are probably out of the question, at least as a first step.

This needs work...

Undoubtedly!

@data-man
Copy link

Can be useful:
qvge - Qt Visual Graph Editor.
nodeeditor - Qt Node Editor. Dataflow programming framework.
adaptagrams - libraries for constraint-based layout and connector routing for diagrams.
dunnart - constraint-based diagram editor.

scottfurry reacted with thumbs up emoji

@justinclift
Copy link
Member

@MKleusberg@mgrojo@scottfurry Any idea how much tweaking this would need, to get it working for putting in our nightly builds?

Am thinking that since we've branched off thev3.12.x stuff, now is probably the time to get stuff like this intomaster and having people test it via the nightlies.

@scottfurry
Copy link
Contributor

@justinclift - yeah. I'm guilty here. It fell off my "projects" plate. I'm in the middle of python stuff at the moment and didn't get to this.

@justinclift
Copy link
Member

No worries, I have that happen all the time too. 😄

@mgrojomgrojo marked this pull request as draftMay 1, 2020 22:01
@MKleusbergMKleusbergforce-pushed themaster branch 5 times, most recently fromd396227 to16035beCompareDecember 26, 2021 13:41
@foxyseta
Copy link

@MKleusberg I've seen various open issues requesting this feature (#913,#1260,and#2034). Any chance someone will work again on this eventually?

Crypto-Spartan reacted with thumbs up emoji

@lucydodolucydodoforce-pushed themaster branch 3 times, most recently from4bc0c36 toe0a000cCompareJuly 2, 2023 13:12
@lucydodolucydodoforce-pushed themaster branch 3 times, most recently from7cf9760 to6aa288cCompareNovember 17, 2023 20:20
@lucydodolucydodoforce-pushed themaster branch 3 times, most recently froma7aaabe toc433bebCompareDecember 19, 2023 01:22
@lucydodolucydodoforce-pushed themaster branch 4 times, most recently from320e303 tod68ebaaCompareJanuary 5, 2025 05:01
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees

@mgrojomgrojo

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

9 participants
@MKleusberg@mgrojo@justinclift@chrisjlocke@SilvioGrosso@scottfurry@data-man@foxyseta@vtronko

[8]ページ先頭

©2009-2025 Movatter.jp