栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 数据挖掘与分析

在线数据库关系图设计工具---- dbdiagram

在线数据库关系图设计工具---- dbdiagram

简介

dbdiagram是一款在线关系型数据库ER图设计系统。

具有以下特点:

  1. 使用DSL语言,可以简单快速地创建数据库关系图;
  2. Online:不需要安装软件,方便快捷,而且支持拖动和调节,使用Google/github账号登录,可以在线保存设计好的图
  3. import/Export : 支持导出DDL SQL和PDF,支持导入外部数据
  4. Share : 可以生成一个分享链接,方便团队成员协作
使用

第一步:点击 Go To App 按钮:

第二步:在左边区域创建数据结构,右边自动生成关系

以下是我们的数据结构(按顺序 账户、分录和转账表):

Table accounts as A {
  id bigserial [pk]
  owner varchar [not null]
  balance bigint [not null]
  currency varchar [not null]
  created_at timestamptz [not null, default: 'now()']
 
 Indexes{
    owner
  }
}

Table entries {
  id bigserial [pk]
  account_id bigint [ref: > A.id, not null]
  amount bigint  [not null, note:'can be negative or postive']
  created_at timestamptz [not null, default: 'now()']

  Indexes{
    account_id
  }
}

Table transfers {
  id bigserial [pk]
  from_account_id bigint [ref: > A.id, not null]
  to_account_id bigint [ref: > A.id, not null]
  amount bigint  [not null, note:'must be postive']
  created_at timestamptz [not null, default: 'now()']
  
  Indexes{
    from_account_id
    to_account_id
    (from_account_id, to_account_id)
  }
}

手写完成后记得点击 Save 保存哦:


通过顶部的 Export 将其导出为您需要的文件(我选择的是 Export to PostgreSQL):

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/278571.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号