国产开源数据库设计工具chiner(PowerDesigner替代软件)
<p data-id="pd157317-XbHBfAKX">最近在造轮子,从 0 到 1 的那种,就差前台的界面了,大家可以耐心耐心耐心期待一下。其中需要设计一些数据库表,可以通过 Navicat 这种图形化管理工具直接开搞,也可以通过一些数据库设计工具来搞,比如说 PowerDesigner,更专业一点。</p>
<p data-id="pd157317-1SAg8GI6">
今天我给大家推荐的这款国人开源的数据库设计工具 chiner,界面漂亮,功能强大,体验后给我的感觉是真香......</p>
<p data-id="pb60e94d-8iiA1HM3">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/dd41ac86fc8a80bc6bc65e778d28d20a.jpg"></p>
<h3 data-id="h0613ccc-U9NFmIIi" id="h0613ccc-U9NFmIIi">
一、 关于 PowerDesigner</h3>
<p data-id="pd157317-dFARl3Gf">
PowerDesigner 是一款功能非常强大的建模工具,可以和 Rational Rose 媲美。Rose 专攻 UML 对象模型的建模,之后才拓展到数据库这块。而 PowerDesigner 是一开始就为数据库建模服务的,后来才发展为一款综合战斗力都还不错的建模工具。</p>
<p data-id="pd157317-XXmZeRdH">
不过,说句实在话,PowerDesigner 的界面偏古典一些,下面是我用 PowerDesigner 设计 DB 的效果。</p>
<p data-id="pb60e94d-NPMGHD0b">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/c7bda2853985d825d643e89de898bfe1.jpg"></p>
<h3 data-id="h0613ccc-meQUFNVA" id="h0613ccc-meQUFNVA">
二、关于 chiner</h3>
<p data-id="pd157317-iQKirO6c">
chiner,发音:,使用React+Electron+Java技术体系构建的一款元数建模平台。</p>
<p data-id="pd157317-NPIaSefi">
2018 年,作者和几个对开源有兴趣的社区好友开始打磨产品的原因,历经三代,直到 2021 年 7 月份,终于推出了船新的 3.0 版本。</p>
<p data-id="pd157317-3EM27nUE">
2019 年底,团队差点解散,幸好有几位好友关照,给了团队两个项目做,这才算是熬了过去。</p>
<p data-id="pd157317-IXPQfRmH">
不得不说,做任何一件事情都不容易啊,光靠情怀也许可以撑过产品初期,但越往后去,遇到生存问题时,就会非常困难。</p>
<p data-id="pd157317-8EXTYknO">
在此,我们必须得为每一位开源作者奉上最真诚的掌声,希望他们的产品都能有一番天地。也希望,未来我的产品出现在大家的面前时,能给它多一点点包容和支持。</p>
<h3 data-id="h0613ccc-kJKLN1M7" id="h0613ccc-kJKLN1M7">
三、安装 chiner</h3>
<p data-id="pd157317-De0e5pRa">
chiner 支持 Windows、macOS 和 Linux,下载地址如下所示:</p>
<p data-id="pd157317-PRcbMXY8">
https://gitee.com/robergroup/chiner/releases</p>
<p data-id="pd157317-xyMX5mAS">
码云做了外部链接的拦截,导致直接复制链接到地址栏才能完成下载。我这里以 macOS 为例。</p>
<p data-id="pb60e94d-lXTkGnG0">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/959aa8614233a3877f2578a4bb9b9126.jpg"></p>
<p data-id="pd157317-117NKeXE">
安装完成后首次打开的样子是这样的。</p>
<p data-id="pb60e94d-BMR5Uhm5">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/5e66da649d657a97daf592851cd22323.jpg"></p>
<p data-id="pd157317-kFU587c6">
chiner 提供了非常贴心的操作手册和参考模板,如果时间比较充分的话,可以先把操作手册过一遍,写得非常详细。</p>
<p data-id="pb60e94d-aXkRAn0G">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/595da1943ddff127c7eb355d01ba52d5.jpg"></p>
<h3 data-id="h0613ccc-TCa8EZPI" id="h0613ccc-TCa8EZPI">
四、上手 chiner</h3>
<h4 data-id="hdf2c2dd-CR4DEK6Y" id="hdf2c2dd-CR4DEK6Y">
01、导入导出</h4>
<p data-id="pd157317-Z7N0R6Iq">
因为我之前有一份 PowerDesigner 文件,所以可以直接导入到 chiner。</p>
<p data-id="pd157317-JAwTlqqp">
第一步,新建一个项目 codingmore。</p>
<p data-id="pd157317-1UCeU1Ns">
第二步,选择导入 PowerDesigner 文件。</p>
<p data-id="pb60e94d-GUcNAeR6">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/865e6c4fefb20aa93493469f074fa290.jpg"></p>
<p data-id="pd157317-89ou44Rp">
第三步,选择要添加的数据表。</p>
<p data-id="pb60e94d-42K57CDZ">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/f384eac1219b8124e4344e0b31f9ac05.jpg"></p>
<p data-id="pd157317-fQH5yK1I">
第四步,导入完成后,就可以点开单表进行查看了。</p>
<p data-id="pb60e94d-llmbTYRB">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/94f7887e5b3961f3dd4eb3e1ad42eb45.jpg"></p>
<p data-id="pd157317-fWgQBnHR">
第五步,当完成重新设计后,就可以选择导出 DDL 到数据库表了。</p>
<p data-id="pb60e94d-2hDMHDOP">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/cde448e0d9059123322dfa38a769cee6.jpg"></p>
<p data-id="pd157317-3fPMwfDn">
当然了,也可以直接配置数据库 DB,这样就可以直接连接导入导出了。</p>
<p data-id="pb60e94d-NnGmGVfZ">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/f6a4ee2362b9d6960312b076cfa212ce.jpg"></p>
<p data-id="pd157317-pEGyjoOK">
导出的 SQL 文件可以直接通过宝塔面板上传到服务器端,然后再直接导入到数据库。</p>
<p data-id="pb60e94d-cLJrlr10">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/76f1e7aad0b90c851d31b4db42f6c592.jpg"></p>
<p data-id="pd157317-9vrJFmLy">
如果需要用到数据库说明文档的话,也可以直接通过导出到 Word 文档来完成。</p>
<p data-id="pb60e94d-aixRpBsd">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/9c675e958f484994d55279647ffd60f6.jpg"></p>
<h4 data-id="hdf2c2dd-iKZ1RgIF" id="hdf2c2dd-iKZ1RgIF">
02、维护数据类型</h4>
<p data-id="pd157317-ElUbgpMv">
chiner 自带了几种常见的数据类型,比如字串、小数、日期等,我们也可以根据自己的需要添加新的数据类型。</p>
<p data-id="pd157317-NeRhFRh5">
比如说默认的字串类型关联到其他数据库的类型如下所示:</p>
<p data-id="pb60e94d-H59yLNdF">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/680cc3a8bbdc6d945569d60eae2871a9.jpg"></p>
<p data-id="pd157317-So5ABYl0">
数据域是在数据类型的基础上,基于当前项目定义的有一定业务含义的数据类型,比如说我这里维护了一个长度为 90 的名称数据域。</p>
<p data-id="pb60e94d-FAOydjzI">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/541b03db387c20e4256cf5eb42693cdf.jpg"></p>
<p data-id="pd157317-8koHTWZ2">
当我需要把某个数据字段的数据域设置成「名称」的时候,长度就会自动填充为 90,不需要手动再去设置。</p>
<p data-id="pb60e94d-VycsKXA0">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/186ac0d92b450aa1cade37397d0b8bcc.jpg"></p>
<h4 data-id="hdf2c2dd-UXUThgB2" id="hdf2c2dd-UXUThgB2">
03、维护数据表</h4>
<p data-id="pd157317-qpR3tV10">
第一步,选中数据表,右键选择「新增数据表」</p>
<p data-id="pb60e94d-UktR95QW">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/7e9138a0c453b9a02b2cd77d10e90254.jpg"></p>
<p data-id="pd157317-gtBONBaK">
第二步,填写数据表名</p>
<p data-id="pb60e94d-V6kS0bfn">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/a07ad49cf1cf91d85da3226deccb74da.jpg"></p>
<p data-id="pd157317-KmjkIW58">
点击「确定」后,chiner 会帮我们自动生成一些常见常用的字段,比如说创建人、创建时间、更新人、更新时间等,非常的智能化。通常来说,这些字段都是必须的。</p>
<p data-id="pb60e94d-GWdaFveo">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/a87f63048584fd5870f19f58c0d35588.jpg"></p>
<p data-id="pd157317-dePX1iRd">
如果这些默认字段不满足需求的时候,还可以点击「设置」新增默认字段,比如说删除标记,一般来说为了安全起见,数据库都会采用非物理删除。</p>
<p data-id="pb60e94d-RIzrexxw">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/264e56a1e1314c3ab42ce342f37cd6e4.jpg"></p>
<p data-id="pd157317-3DXGIqQB">
一般来说,我们更习惯字段小写命名,因此可以直接选中一列,然后选择大小写转换。</p>
<p data-id="pb60e94d-L0aG9IDG">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/a6f2bbd7a1f9b852531770690994a820.jpg"></p>
<p data-id="pd157317-NPP0iEbV">
就变成小写了。</p>
<p data-id="pb60e94d-4XAiQYKj">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/6f6128809bbe98c6d30270e69846acca.jpg"></p>
<h4 data-id="hdf2c2dd-ik4blXhU" id="hdf2c2dd-ik4blXhU">
04、维护关系图</h4>
<p data-id="pd157317-9fhKZbAB">
第一步,选择「关系图」,右键选择「新增关系图」</p>
<p data-id="pd157317-WYT0LnEP">
第二步,把需要关联的表拖拽到右侧的面板当中,然后按照字段进行连线,非常的方便。比如说班级和学院表、班级和专业表的关系,就如下图所示。</p>
<p data-id="pb60e94d-DRIKyhfH">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/2fa26f451fe08b76a1b7171ce3adfaee.jpg"></p>
<p data-id="pd157317-cq5VnfQ9">
来看一下整体给出来的关系图,还是非常清爽的。</p>
<p data-id="pb60e94d-rqavfzFm">
<img title="国产开源数据库设计工具chiner(PowerDesigner替代软件)" alt="国产开源数据库设计工具chiner(PowerDesigner替代软件)" src="https://zhuji.jb51.net/uploads/img/202305/7884c81a6bdb9fef071dcecc22996d88.jpg"></p>
<h3 data-id="h0613ccc-MHbegHg6" id="h0613ccc-MHbegHg6">
五、尾声</h3>
<p data-id="pd157317-4qgQwJbj">
chiner 还有更多更强大的功能,大家觉得不错的话,可以去尝试一下。用的熟练的话,肯定能在很大程度上提高生产效率。</p>
<p data-id="pd157317-mL9jw9lu">
就我个人的使用体验来说,chiner 比 PowerDesigner 更轻量级,也更符合日常的操作习惯,为国产开源点赞!</p>
<p>
原文地址:https://mp.weixin.qq.com/s/wz45cb-aEeBaeUrnrodQtQ</p>
頁:
[1]