如何记录数据库 [英] How to document a database

查看:131
本文介绍了如何记录数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(注意:我认识到这是接近如何记录您的数据库结构?,但我不认为它是一样的。)

(Note: I realize this is close to How do you document your database structure? , but I don't think it's identical.)

我已经开始在数据库的工作,数百个表和视图,所有这些都是具有非常少的元音的隐藏名称,没有文档。他们也不允许对数据库模式进行免费更改,也不能触摸任何数据库,除了我自己的机器上的测试(经常被破坏和重新创建)之外的任何数据库,所以我不能添加可以帮助任何人的评论。

I've started work at a place with a database with literally hundreds of tables and views, all with cryptic names with very few vowels, and no documentation. They also don't allow gratuitous changes to the database schema, nor can I touch any database except the test one on my own machine (which gets blown away and recreated regularly), so I can't add comments that would help anybody.

我尝试使用Toad创建一个ER图,但直到它运行了48小时,仍然没有产生任何可见的东西,我需要我的电脑。我正在谈论其他最近的一些雇员,我们都建议,每当我们困惑一个特定的表格或其中一些列的含义时,我们应该在开发人员wiki中更新。

I tried using "Toad" to create an ER diagram, but after leaving it running for 48 hours straight it still hadn't produced anything visible and I needed my computer back. I was talking to some other recent hires and we all suggested that whenever we've puzzled out what a particular table or what some of its columns means, we should update it in the developers wiki.

那么有什么好办法呢?只需列出表格/视图及其列,并按照我们的方式填写?我需要的基本工具是Toad,Oracle的SQL Developer,MS Office和Visio。

So what's a good way to do this? Just list tables/views and their columns and fill them in as we go? The basic tools I've got to hand are Toad, Oracle's "SQL Developer", MS Office, and Visio.

推荐答案

我的经验,ER(或UML)图不是最有用的工具 - 大量的表,图表(特别是反向工程图)通常是一个很大的复杂混乱,没有人从中学到任何东西。

In my experience, ER (or UML) diagrams aren't the most useful artifact - with a large number of tables, diagrams (especially reverse engineered ones) are often a big convoluted mess that nobody learns anything from.

对于我的钱,一些很好的可读文档(可能补充了系统较小部分的图表)将为您提供最大的里程。对于每个表,这将包括:

For my money, some good human-readable documentation (perhaps supplemented with diagrams of smaller portions of the system) will give you the most mileage. This will include, for each table:


  • 描述表的意思及其功能如何(在UI等中)

  • 描述每个属性意味着什么,如果不明显

  • 从这个表到其他人的关系(外键)的说明和副-versa

  • 其他约束和/或触发条件的说明

  • 主要视图和触摸表的过程,如果它们没有很好的记录已经

  • Descriptions of what the table means and how it's functionally used (in the UI, etc.)
  • Descriptions of what each attribute means, if it isn't obvious
  • Explanations of the relationships (foreign keys) from this table to others, and vice-versa
  • Explanations of additional constraints and / or triggers
  • Additional explanation of major views & procs that touch the table, if they're not well documented already

所有上述内容,不要为了文件记录 - 重要的文件,显而易见的是以人的方式。相反,专注于首先困惑你的东西,花几分钟时间写出清晰,简洁的解释。这将帮助您思考,并且它将大量地帮助其他开发人员首次遇到这些表。

With all of the above, don't document for the sake of documenting - documentation that restates the obvious just gets in people's way. Instead, focus on the stuff that confused you at first, and spend a few minutes writing really clear, concise explanations. That'll help you think it through, and it'll massively help other developers who run into these tables for the first time.

As其他人提到,有各种各样的工具来帮助您管理这一点,例如 Enterprise Architect ,一个href =http://www.red-gate.com/products/SQL_Doc/index.htm =noreferrer> Red Gate SQL Doc 以及各种厂商的内置工具。但是,虽然工具支持是有帮助的(甚至在更大的数据库中也是至关重要的),在理解和解释的努力中,数据库的概念模型是真正的胜利。从这个角度来说,你甚至可以在一个文本文件中进行操作(尽管在维基页面中可以使用这些文件可以让几个人逐渐加入文档中进行合作,所以每当有人弄清楚某些东西时,他们可以将它添加到不断增长的身体的文件)。

As others have mentioned, there are a wide variety of tools to help you manage this, like Enterprise Architect, Red Gate SQL Doc, and the built-in tools from various vendors. But while tool support is helpful (and even critical, in bigger databases), doing the hard work of understanding and explaining the conceptual model of the database is the real win. From that perspective, you can even do it in a text file (though doing it in Wiki form would allow several people to collaborate on adding to that documentation incrementally - so, every time someone figures out something, they can add it to the growing body of documentation instantly).

这篇关于如何记录数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆