如何记录数据库代码以查看数据库对象之间的依赖关系? [英] How do you document your database code to see dependencies between database objects?

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

问题描述

我想在我的宠物项目中编写文档。



我的PostgreSQL数据库中有30个表和近50个视图以及约30个函数(存储过程) / p>

我想看看哪些表(哪些视图和哪些函数)被使用。



我想看看在哪里使用视图(哪些视图和哪些函数)。



我想看看另一个函数是否使用了一个函数。



我还要写出每个对象(表格,视图和函数)的描述,



和字段的简短描述。 >

很快,我想能看到使用特定对象以及哪些对象使用特定对象。



I以为使用文本文件和每个对象。
我可能会列出使用当前使用的对象,当前使用哪些对象。

 < pre> ; 
表aaaa
一个简短的描述
用于:视图v_aaaa

id int主键
名称varchar(30)...的名称...

==============================
查看v_aaaa
A简短描述

字段列表...

由函数f_aaaa使用
取决于表aaaa



============================

函数f_aaaa
简短描述
参数(描述,IN / OUT)
取决于视图v_aaaa
函数fbbbb

================= =============

函数f_bbbb
简短描述
参数
由函数f_aaaa调用

我担心我的文档将不快速同步
想象一下,我添加一个调用f_aaaa和f_bbbb的函数f_cccc。我必须修改f_aaaa和f_bbbb上的文档



我知道UML描述了关于实体的关系(这样做,对吗?
但是我想要一些简单的东西,我不想跟着75个小时的训练...
我不知道你可以在实体和功能之间有一个链接,我想要的。



你有什么建议我吗?



我在Linux(Fedora)上使用PostgreSQL。如果你提出一个这样做的工具,它必须与PostgreSQL兼容: - )



对于我的代码文档,我使用Doxygen。



谢谢

解决方案

我终于构建了一个巨大的hmtl文件。



文件包含很多锚点,很容易导航到不同的对象。



这是很多工作,但它正是我想要的: )


I want to write documentation on my pet project.

I have 30 tables and almost 50 views and about 30 functions (stored procedures) in my PostgreSQL database.

I would like to see where tables ( which views and which functions ) are used.

I would like to see where views ( which views and which functions ) are used.

I would like to see if a function is used by another function.

I would like also to write a description of each objects ( tables, views and functions )

and a short description of fields.

Shortly, I want to be able to see what use a specific object and which objects use a specific object.

I thought to use a text file and for every object. I might list objects that use the current one and which ones are used by the current one.

<pre>
Table aaaa
A short description
used by : view v_aaaa

id  int     primary key
name  varchar(30)   name of a...

================================
view v_aaaa
A short description

list of fields...

used by function f_aaaa
Depends on  table aaaa



==============================

function f_aaaa
A short description
Parameters ( description, IN/OUT )
Depends on view v_aaaa
           function fbbbb 

==============================

function f_bbbb
A short description
Parameters
Called by function f_aaaa

I'm afraid that my documentation will be unsynchronize quickly Imagine I add a function f_cccc that calls f_aaaa and f_bbbb. I'll have to modify doc on f_aaaa and f_bbbb

I know that UML describes relations about entities (It does that, right ???). But I want something simple and I don't want to follow a 75 hours training... And I'm not sure that you can have a "link" between entities and function as I want.

Do you have something to suggest me ?

I use PostgreSQL on Linux (Fedora). If you propose a tool that do this, it must be compatible with PostgreSQL :-)

For my code documentation, I use Doxygen.

Thank you

解决方案

I finally build a huge hmtl file.

File contains alot of anchors and it's easy to navigate to different objects.

It's a lot of work but it was exactly what I want :-)

这篇关于如何记录数据库代码以查看数据库对象之间的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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