xwsg / plantuml2ddl

Intellij IDEA plugin- MySQL/PostgreSQL DDL and PlantUML convert to each other.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File not found

RobotAvi opened this issue · comments

  1. Open a PlantUML file

  2. In this file, Right-click or Alt-Insert

  3. Select Generate -> PlantUML -> DDL.
    Says "PlantUml file not found!"

  4. Open a DDL file

  5. In this file, Right-click or Alt-Insert

  6. Select Generate -> DDL -> PlantUMLL
    Says "DDL file not found!"
    image

Tried to download project. So the reason is not "File not found". The cause is the structure of the file. Example is in attach
what_I_try_to_convert.txt

Doesn't work:

@startuml
entity Clients {
*id
client_id
user_name
FIO
}

entity Users {
*id
user_id
role_id
FIO
}

Clients }|.r.|| Users
@enduml

Works but without FK:

@startuml
entity "Clients" as clients{

  • client_id: bigint(20)
    user_name: bigint(20)
    FIO: bigint(20)
    }

entity "Users" as users {

  • user_id: bigint(20)
  • client_id: bigint(20) <>
    role_id: bigint(20)
    FIO: bigint(20)
    }

clients }|-r-|| users

@enduml

commented

Need field type explicitly and FK isnot supported.

我也遇到了相同的问题,只不过我是从 SQL 文件转为 PlantUML 时的提示。请问一下是什么原因呢?
image

我查看源码后找到问题了,因为我的 DDL 脚本在 IDEA 格式化后,第一行的 CREATE TABLE table_name ( 的括号被换行了,导致项目里的正则表达式无法识别到 Table 。把括号切换到 Create 语句那一行即可。

image

@ReberMusk 我也出现这问题了,但是 似乎和你的原因不一样,还可能有什么原因 会导致这个问题?

commented

@waintang
这里有个bug,必须要有主键,要不然会报错,建议先这样

create table tbluser (
    id BIGINT(20) not null,
    type TINYINT(4) not null,
+    PRIMARY KEY (id)
) COMMENT '用户表';

@xwsg 解决了,感谢【确实 加了PRIMARY KEY (id) 就好了】