Coder Social home page Coder Social logo

drawdb-io / drawdb Goto Github PK

View Code? Open in Web Editor NEW
11.6K 48.0 776.0 3.86 MB

Free, simple, and intuitive online database design tool and SQL generator.

Home Page: https://drawdb.vercel.app

License: MIT License

HTML 0.36% JavaScript 97.95% CSS 1.61% Dockerfile 0.09%
database-schema editor mariadb postgresql sql sql-server sqlite svg react indexeddb

drawdb's People

Contributors

1ilit avatar aniketjadhav16 avatar atiehamidi avatar ayshahakeem avatar clapalo avatar cmc-pvhieu avatar dependabot[bot] avatar dnlrq avatar dott1e avatar gautamkrishnar avatar haecheonlee avatar harris2012 avatar imhalid avatar jeanfranz73 avatar jonas-grgt avatar l123wx avatar lovelesscodes avatar magmongoing avatar phamhieu275 avatar santilapi13 avatar soraxv avatar yash-chudasama 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  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  avatar  avatar  avatar  avatar

Watchers

 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

drawdb's Issues

Undo action when field is deleted

The undo action seems unreliable. I was able to reproduce the issue below :

Steps :

  1. Create 2 tables (table with ID int, table2 with ID int)
  2. Create a relation between table.ID and table2.ID
  3. Save
  4. Remove filed table2.ID
  5. Save
  6. Undo

Result :
table2.ID is restored, but it's relationship with table.ID is lost.

Expected result :
table2.ID is restored with it's relationship(s).

[Proposal] Add an option whether to create foreign keys.

For the relationship between objects, can we design an option to decide whether to create foreign keys when generating database statements. Sometimes, we need to clarify the relationship between objects when designing, but at the database level, we do not want to create foreign keys.

[Feature] Docker image

Would be nice if there is a docker image for this tool so it can be more easily run and deployed.

Can we consider increasing the workspace

At present, I have found that the save function cannot be used well, and it is not possible to create isolation for multiple projects, so each time only import and export can be done.

Now the data is stored in the browser database. If the browser is accidentally cleaned and not exported in a timely manner, all data will be lost

[Suggestion] Schema/Table Group Support

I just moved my project from DBDiagram.io to drawDB (since it is easier for newcomers, and it is awesome!)

After I use it for a while, I would like to provide feedback based on my use case. One feedback is already mentioned in #12. Another one is related to schema/table group support.

For me, my biggest feature that could improve my workflow drastically is to include schema support for each table. Before you may ask, yes, subject area is a workaround for that.

But I think it would be easier to select schema, then create table inside schema, and group them inside the same schema area.

I understand that this feature is quite complex, honestly. However, it should improve my existing workflow that involved with several schema and a ton of tables.

An error occurs when executing sql import

An error occurs when executing sql import
image

page error
image

error detail

index-zgz2iI-B.js:454 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'toString')
    at index-zgz2iI-B.js:454:3962
    at Array.forEach (<anonymous>)
    at index-zgz2iI-B.js:454:3611
    at Array.forEach (<anonymous>)
    at OZe (index-zgz2iI-B.js:454:3429)
    at Xn (index-zgz2iI-B.js:465:20027)
    at Object.In [as onOk] (index-zgz2iI-B.js:465:20583)
    at Object.notifyOk (index-zgz2iI-B.js:54:89260)
    at k$e.handleOk (index-zgz2iI-B.js:54:72272)
    at Uy.handleOk (index-zgz2iI-B.js:54:86078)

The sql script is as follows

CREATE TABLE `sssqc` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `station_name` varchar(30) NOT NULL ,
  `rvnm` varchar(30) NOT NULL ,
  `tm` datetime NOT NULL ,
  `rz` float DEFAULT NULL ,
  `otq` float DEFAULT NULL ,
  `rwptn` varchar(10) DEFAULT NULL ,
  `rwptn_name` varchar(10) DEFAULT NULL ,
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
  `gmt_modify` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
  PRIMARY KEY (`id`),
  UNIQUE KEY `station_name` (`station_name`,`tm`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ;

[Feature] Make drawdb a PWA

I recently came across drawdb and it looks great. If it can be turned into a PWA it would be much better. We can install it like an app and will take full screen height without URL bar. Hope this will be considered.

Auto swap for foreign key name

IF I create a table A with column id, Table B with column id and a_id,
then A.id and B.a_id is a one to many relation

when i drag b.a_id to a.id the relation name is called B_a_id_fk, and A is primary and B is foreign, this is correct

图片

but, when i drag a.id to b.a_id, the relation name is called A_id_fk, B is primary, A is foreign, this is not correct,
图片

so, i can use swap function to adjust which is the primary, then A is primary and B is foreign, this is correct, but the foreign key name is also called A_id_fk

图片

so can it autoamtically correct the fk name when swap?

Auto generating Table

LLM can be used to autogenerate table for some standard use cases or can have a chat assistant to generate queries based on the db selected.

Adding the Ability to Share Database Diagrams via Links

We propose adding a feature that allows users to create links to their database diagrams and share them with other participants. This will enable users to quickly and easily exchange their data models, facilitating collaboration and learning.

show comment

Can you customize whether you need to display comments on the table? table and field comments. Shown after type.

Change the order of the fields in a table

The style of this tool is exceptionally elegant, enhancing the experience of database design. Gratitude to all contributors!

But i want it include a feature that can change the order of the fields in a table.

image

Add Support for nvarchar Datatype

Currently, DrawDB does not support the nvarchar datatype. This datatype is commonly used in SQL Server databases for storing variable-length Unicode string data.
We kindly request the DrawDB development team to prioritize the implementation of nvarchar datatype support in the upcoming releases. This enhancement will significantly improve the compatibility and user experience for SQL Server database users.

image

[Feature] Have a way to collaborate

Since this only saves data in the browser there is no way to have 2 people working on the same diagram at the same time. But as a workaround it would be nice if I could save the diagram to a file in our repo, then when someone wants to edit / view it they can run a docker image locally that would read the file and load the diagram into the local instance. They would still need to export the file afterwords and commit unless there could be a feature to only read/write to a file instead of indexedDB.

Field Circle Icons

Blue circle icons next to fields show out of position on Safari:

image

Looks fine on Google Chrome:

image

Linux unexpected reserve word

file:///home/dongwook/Documents/drawdb/node_modules/vite/bin/vite.js:7
await import('source-map-support').then((r) => r.default.install())
^^^^^

SyntaxError: Unexpected reserved word

I just followed the installation process and when i run npm run dev it shows that message

edit relationship

Can you double-click the line to edit the relationship? When I have many relationships, it is difficult to find it in the relationship list.

[suggestion]Comment in export sql

now:

/* user table */
CREATE TABLE `table_user` (
	`user_id` BIGINT NOT NULL AUTO_INCREMENT UNIQUE,
	-- userName
	`user_name` VARCHAR(255),
	`dept_id` BIGINT,
	PRIMARY KEY(`user_id`)
);

expect:

CREATE TABLE `table_user` (
	`user_id` BIGINT NOT NULL AUTO_INCREMENT UNIQUE,
	`user_name` VARCHAR(255) comment 'userName',
	`dept_id` BIGINT,
	PRIMARY KEY(`user_id`)
) comment 'user table';

[Feature] Copyable `Enum`

Thanks very much for this tool!

I am wondering if it would be possible to convert the Enum values in the field description from boxes to text on double click, so that I can copy the existing Enums (csv) to another place? Currently that is not possible, and I need to retype or jump into some text representation of the diagram.

Render to image

Rendering the Diagram to an image would be helpful for automatically generating documentation.

Diagrams help us visualise those relationships and they can also be beneficial to non-developers.

Please consider adding a command to render the diagram to an image (png preferably with option to generate with or without background for nice embedding)

Enum values are not getting entered on mobile

To reproduce:

Enter value and click enter or enter comma separated values in batch and click enter

Expected behavior:

The values should look like tags and the input field should no longer give an error

Actual behavior:

Focus goes to comment input field and the enum values input still shows an error

Browser:

Chrome

OS:

Android

Screenrecorder-2024-04-29-13-05-14-294.mp4

Auto layout

Hi, ok draw-db is incredible, I'm obsessed!

Is there an auto-layout for use after importing? It seems all tables import on-top of each other and have to be hand sorted.

Does some form of auto arrangement exist and or is it possible to add?

Issue with RestoreScroll.

Guys, your code is amazing! Its really intresting to learn it) But I found a non-critical bug I think in the main App.js file in the RestoreScroll function at line 85, I think you should probably replace useEffect with useLayoutEffect because when you try to reload the page you get a little annoying page jerking)

Relationships are not always imported correctly from source

When importing the following SQL, the relationships between the tables are not imported:

CREATE TABLE `Pattern` (
	`Id`	INT NOT NULL AUTO_INCREMENT,
	`Description`	VARCHAR(255),
	`IsFlexible`	BOOLEAN DEFAULT (FALSE),
	`IsInterpolated`	BOOLEAN NOT NULL DEFAULT (FALSE),
	`PatternType`	INT NOT NULL,
	`ScenarioId`	INT NOT NULL,
	CONSTRAINT `PK_Pattern` PRIMARY KEY(`Id`)
);
CREATE TABLE `PatternDateValue` (
	`PatternId`	INT NOT NULL,
	`Date`	DATETIME NOT NULL,
	`Value`	DOUBLE,
	CONSTRAINT `PK_PatternDateValue` PRIMARY KEY(`PatternId`,`Date`),
	CONSTRAINT `FK_PatternDateValue_Pattern_PatternId` FOREIGN KEY(`PatternId`) REFERENCES `Pattern`(`Id`) ON DELETE CASCADE
);
CREATE TABLE `PatternNumberValue` (
	`PatternId`	INT NOT NULL,
	`Number`	SMALLINT NOT NULL,
	`Value`	DOUBLE,
	CONSTRAINT `PK_PatternNumberValue` PRIMARY KEY(`PatternId`,`Number`),
	CONSTRAINT `FK_PatternNumberValue_Pattern_PatternId` FOREIGN KEY(`PatternId`) REFERENCES `Pattern`(`Id`) ON DELETE CASCADE
);

Other relationships work as expected though. I can't figure out why some work and some don't.

Here is one that is imported correctly:

CREATE TABLE `ScenarioGroup` (
	`Id`	INT NOT NULL AUTO_INCREMENT,
	`Description`	VARCHAR(255),
	`Name`	VARCHAR(255),
	`DateCreated`	DATETIME NOT NULL,
	CONSTRAINT `PK_ScenarioGroup` PRIMARY KEY(`Id`)
);
CREATE TABLE `Scenario` (
	`Id`	INT NOT NULL AUTO_INCREMENT,
	`ScenarioGroupId`	INT NOT NULL,
	`DateCreated`	DATETIME NOT NULL,
	`Name`	VARCHAR(255),
	`Description`	VARCHAR(255),
	`ActiveSimulationId`	INT DEFAULT (0),
	`IsUpdateActive`	BOOLEAN DEFAULT (TRUE),
	`OperationalInfo`	VARCHAR(255),
	CONSTRAINT `PK_Scenario` PRIMARY KEY(`Id`),
	CONSTRAINT `FK_Scenario_ScenarioGroup_ScenarioGroupId` FOREIGN KEY(`ScenarioGroupId`) REFERENCES `ScenarioGroup`(`Id`) ON DELETE CASCADE
);

DBML support

I would love this to support DBML. Tools like dbdiagram.io are nice but not OSS and their editor is also not as pretty as yours. But the ability to compile DBML to schemas of many databases (postgresql, mysql, etc...) is a major benefit. I would love this tool to also be able to generate diagrams from DBML of generate DBML from diagrams.

[Feature][Suggestion]Geometry Support

Hello,

I've tested your software earlier, and it's very nice.

Working with geodatabase using Postgis, one addition that could be very interesting, is support for Geometry data type.
Indeed, For now it's not possible to select this type, but it'll could be great.
Or maybe letting the user specify a custom column type.

I may look into it if I find the time.

Thansk in advance for any answer,
Regards, Clément.

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.