Comments (13)
Additional info on KEY index: see.
from erd-editor.
vcode extension v0.9.7 has been reflected.
from erd-editor.
Seems to be partially fixed both indexes are not present as keys in the table, but only the "KEY" index is added to the indexes of the table. The unique index is missing.
Try to run my example SQL.
from erd-editor.
Automatically generated indexes are not explicitly managed as index data.
from erd-editor.
Okay but an UNIQUE index isn't automatically generated or rather the user still needs to add it.
So i would say since you're saving for every entity the indices it has, this index is then lost on import.
from erd-editor.
from erd-editor.
Nono that's not what i mean.
I'm saying that on the Database->Indexes page only the name index is listed, the unique email index is not there.
from erd-editor.
Yeah, if i add the view change i can see it aswell. But it is still not present in the table properties tab.
from erd-editor.
Doesn't UNIQUE KEY generate indexes automatically?
from erd-editor.
It does, but i think it makes sense for it to be in the list of indexes.
Also it wether a key is unique or not is not taken into account in the generated SQL atm it seems.
I personally think all indexes should be listed in the table properties indexes section of the app, it can be confusing to the user to see some indexes only when you change the app view.
Honestly i doesn't really matter where you define the indexes: wether it be immediately in the CREATE TABLE statement or in a following CREATE INDEX statement.
from erd-editor.
I checked that it was missing from the simple table SQL DDL.
PRIMARY KEY, UNIQUE KEY can't be edited.
I think it needs to be done in a way that only shows the list.
from erd-editor.
Okay no, I wasn't talking about the Primary key. That's fine the way it is.
I'm talking about the custom UNIQUE index i'm creating on email.
According to this
You can actually add the unique index just fine later with the CREATE INDEX statement (it automatically does the alter table for you).
I think i understand what you where saying earlier.
I suppose it's up to you wether you want to list all indexes in the Table Properties Indexes.
I don't think it's going to be problematic, might even be more user friendly, you could aswell list the primary key index there aswell.
Now how you actually generate the table could change based on how every index is defined:
-
The PRIMARY INDEX ofcourse needs to happend in the CREATE TABLE.
-
UNIQUE index with only 1 key can be rapresented with the UNIQUE keyword in the table definition query.
-
Other more complex index could be added either as a KEY statement or with extra CREATE INDEX statements.
Again i don't think it matters that much as all of the SQL it is generating is going to be used to create a DATABASE from scratch.
I just think it can be confusing not listing just UNIQUE immediate indexes in the Table Properties, as you will only be able to see them by changing the table view.
from erd-editor.
For example the SQL query i was tesing with can be rapresented as:
CREATE TABLE 'users' (
'id' bigint unsigned NOT NULL AUTO_INCREMENT,
'name' varchar(30) NOT NULL,
'email' varchar(30) NOT NULL UNIQUE,
PRIMARY KEY ('id'),
KEY 'user_name_index' ('name')
);
Of course with multi key indexes you need to use the KEY statement.
Or as:
CREATE TABLE 'users' (
'id' bigint unsigned NOT NULL AUTO_INCREMENT,
'name' varchar(30) NOT NULL,
'email' varchar(30) NOT NULL,
PRIMARY KEY ('id'),
);
CREATE UNIQUE INDEX users_email_index
ON users(email ASC);
CREATE INDEX users_name_index
ON users(name ASC);
from erd-editor.
Related Issues (20)
- How can we import external DDL HOT 1
- Diagram relationship paths have unnecessary cross overs HOT 3
- Unable to zoom more than 100%
- Tree and table views in v3 HOT 4
- many to many? HOT 2
- Automatic similarity between primary key and foreign key makes the foreign key adopt the extra fluff of the primary key. HOT 1
- There is no grid view HOT 1
- Allow hiding sidebar in erd-editor.io HOT 1
- Hope to support copy and paste table HOT 3
- How to AUTO_INCREMENT on mysql HOT 1
- Links from a table to itself are displayed incorrectly
- Make table names more distinguishable from column names
- Thinner links would reduce clutter and improve readability of diagrams
- SQL Comments not imported correctly in PostgreSQL format
- Automatically crop export PNG to content
- move all nodes or move canvas
- Keep unknown datatypes when importing
- ON DELETE CASCADE HOT 1
- Theme: Appearance not respected HOT 2
- Guides on how to contribute to the project HOT 3
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 erd-editor.