Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2823F2E0340; Tue, 4 Mar 2008 16:58:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08666-06; Tue, 4 Mar 2008 16:58:01 -0400 (AST) X-Greylist: delayed 00:12:09.619047 by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from homsrv01.homisco.local (mail.homisco.com [64.213.65.19]) by postgresql.org (Postfix) with ESMTP id 8BDAF2E034D; Tue, 4 Mar 2008 16:58:01 -0400 (AST) Received: from [192.168.10.102] ([192.168.10.102]) by homsrv01.homisco.local with Microsoft SMTPSVC(5.0.2195.6713); Tue, 4 Mar 2008 15:45:51 -0500 Message-ID: <47CDB4FF.4000408@oisinglynn.com> Date: Tue, 04 Mar 2008 15:45:51 -0500 From: Oisin Glynn User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Shahaf Abileah CC: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] Documenting a DB schema References: <082D8A131DF72A4D88C908A1AD3DEB22023B34F2@mail-1.rf.lan> In-Reply-To: <082D8A131DF72A4D88C908A1AD3DEB22023B34F2@mail-1.rf.lan> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 04 Mar 2008 20:45:51.0519 (UTC) FILETIME=[BBDD9AF0:01C87E38] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/19 X-Sequence-Number: 28502 Shahaf Abileah wrote: > > I’m looking for a systematic way to document the schema for the > database behind our website (www.redfin.com ), > so that the developers using this database have a better idea what all > the tables and columns mean and what data to expect. Any recommendations? > > It would be great if the documentation could be kept as close to the > code as possible – that way we stand a chance of keeping it up to > date. So, in the same way that Java docs go right there on top of the > class or method definitions, it would be great if I could attach my > comments to the table definitions. It looks like MySQL has that kind > of capability: > > create table table_with_comments(a int comment 'this is column a...'); > > (see http://dev.mysql.com/doc/refman/5.0/en/create-table.html) > > However, Postgres doesn’t support the “comment” keyword. Is there an > alternative? > > Thanks, > > --S > > *Shahaf Abileah *|* Lead Software Developer * > > shahaf@redfin.com | tel: 206.859.2869 | fax: 877.733.3469 > > Redfin Corporation > 710 2nd Ave > Suite 600 > Seattle, WA 98104 > Its probably best to try one list and see if you get a response rather than sending the same message to 3 lists. Comments are supported CREATE TABLE follow_me_destination ( mailbox_number character varying(10), -- Follow me users mailbox number. destination_number character varying(32), -- Follow me phone number. dest_id serial NOT NULL ) WITHOUT OIDS; ALTER TABLE follow_me_destination OWNER TO postgres; COMMENT ON TABLE follow_me_destination IS 'Stores follow me numbers for system users.'; COMMENT ON COLUMN follow_me_destination.mailbox_number IS 'Follow me users mailbox number.'; COMMENT ON COLUMN follow_me_destination.destination_number IS 'Follow me phone number.';