Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
How do you describe the fields in your database?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 26 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
MarkBennett  
View profile  
 More options Nov 3 2009, 7:56 pm
From: MarkBennett <mark.f.benn...@gmail.com>
Date: Tue, 3 Nov 2009 16:56:44 -0800 (PST)
Local: Tues, Nov 3 2009 7:56 pm
Subject: How do you describe the fields in your database?
I'm working on an application where the fields in our model have very
specific meanings and affect payments made to our users.  Because of
this understanding the purpose and meaning of each field is important.

I've been looking for the best way to describe the model fields, and
would ideally like to leave comments in the db/schema.rb, however this
if rebuild after I run each migration.  What is the best way to
document fields and to share their purpose with the team?  I can't
find a comment or description field to use the migration code, and
describing each field in the model file itself doesn't seem very DRY.

Thanks!


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bodaniel Jeanes  
View profile  
 More options Nov 3 2009, 8:05 pm
From: Bodaniel Jeanes <m...@bjeanes.com>
Date: Wed, 4 Nov 2009 11:05:43 +1000
Local: Tues, Nov 3 2009 8:05 pm
Subject: Re: [rails-oceania] How do you describe the fields in your database?

Why do you find describing the fields in the model unDRY? If it were me,
that's exactly where I'd put them as this is where developers will interact
with those fields the most.

Another idea might be to patch migrations to use the field comment feature
of some DBs like MySQL. However without actually checking that, it's not
really helpful as most developers won't regularly check the schema.rb or the
raw database to see those values.

Ultimately if the purpose is for documentation, it should be somewhere that
developers will expect to find documentation: the README, the doc/
directory, or in comments in the code (such as in the model that it is
relevant to).

Bo

On Wed, Nov 4, 2009 at 10:56 AM, MarkBennett <mark.f.benn...@gmail.com>wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Healy  
View profile  
 More options Nov 3 2009, 8:12 pm
From: James Healy <ji...@deefa.com>
Date: Wed, 4 Nov 2009 12:12:01 +1100
Local: Tues, Nov 3 2009 8:12 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

Bodaniel Jeanes wrote:
> Ultimately if the purpose is for documentation, it should be somewhere that
> developers will expect to find documentation: the README, the doc/
> directory, or in comments in the code (such as in the model that it is
> relevant to).

The only problem with that is that a developer may create a migration
and forget to update the field descriptions in the model. Out of date
and wrong comments are the worst.

I like the idea of patching migrations to use the field comment in the
database. Then plugins like annotate models could pull the comment and
write it to the model file for easy access.

-- James Healy <ji...@deefa.com>  Wed, 04 Nov 2009 12:11:46 +1100


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MarkBennett  
View profile  
 More options Nov 3 2009, 8:19 pm
From: MarkBennett <mark.f.benn...@gmail.com>
Date: Tue, 3 Nov 2009 17:19:18 -0800 (PST)
Local: Tues, Nov 3 2009 8:19 pm
Subject: Re: How do you describe the fields in your database?
Right now I look in the db/schema.rb to see the list of fields
associated with a model and assume that is where most other people
look for these fields, which is why I wanted to put the descriptions
there.  My thinking is that repeating this list of fields again in the
code in app/models is unDRY because you've now got to maintain the
same list of fields in both places.

When you say most developers don't regularly check the schema.rb, how
do you know what a model's fields are without doing this?  I agree
that most developers, myself included, usually go to the app/model
file first when coding.  This is one of the few things I find annoying
about ActiveRecord because I often have to have the db/schema.rb and
app/models file open at the same time.  If there is a good way to add
these comments to the model I'd rather describe them there so that
they also appear in the rdoc.  An example would probably help the
most.

Thanks for your quick reply!

On Nov 4, 12:05 pm, Bodaniel Jeanes <m...@bjeanes.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bodaniel Jeanes  
View profile  
 More options Nov 3 2009, 8:20 pm
From: Bodaniel Jeanes <m...@bjeanes.com>
Date: Wed, 4 Nov 2009 11:20:26 +1000
Local: Tues, Nov 3 2009 8:20 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

> The only problem with that is that a developer may create a migration
> and forget to update the field descriptions in the model. Out of date
> and wrong comments are the worst.

Good point. Hard to find documentation still sucks though

> I like the idea of patching migrations to use the field comment in the
> database. Then plugins like annotate models could pull the comment and
> write it to the model file for easy access.

If the process of pulling out the value of these fields and displaying them
somewhere is automatic this scenario would become very useful.

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bodaniel Jeanes  
View profile  
 More options Nov 3 2009, 8:23 pm
From: Bodaniel Jeanes <m...@bjeanes.com>
Date: Wed, 4 Nov 2009 11:23:04 +1000
Local: Tues, Nov 3 2009 8:23 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

On Wed, Nov 4, 2009 at 11:19 AM, MarkBennett <mark.f.benn...@gmail.com>wrote:

> Right now I look in the db/schema.rb to see the list of fields
> associated with a model and assume that is where most other people
> look for these fields, which is why I wanted to put the descriptions
> there.  My thinking is that repeating this list of fields again in the
> code in app/models is unDRY because you've now got to maintain the
> same list of fields in both places.

Sure. My point should have been more that you *don't* maintain the schema.rb
file -- the migrations do.

When you say most developers don't regularly check the schema.rb, how

> do you know what a model's fields are without doing this?

I usually just type in the class name in my (already open) console window:

>> Account

=> Account<id: integer, created_at: datetime, updated_at: datetime,
full_domain: string, deleted_at: datetime, owner_id: integer>

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josh Price  
View profile  
 More options Nov 3 2009, 8:28 pm
From: Josh Price <jos...@gmail.com>
Date: Wed, 4 Nov 2009 12:28:03 +1100
Local: Tues, Nov 3 2009 8:28 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

Does anyone still use the annotate models plugin?

http://agilewebdevelopment.com/plugins/annotate_models

It takes your schema and put it as a comment block at the top of your model
classes. Combined with migration-based comments this might work for you.

When I used this a while back I found keeping it up to date manually mildly
annoying, but if your schema isn't going to change much then it might be a
good solution.

Josh


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MarkBennett  
View profile  
 More options Nov 3 2009, 8:34 pm
From: MarkBennett <mark.f.benn...@gmail.com>
Date: Tue, 3 Nov 2009 17:34:15 -0800 (PST)
Local: Tues, Nov 3 2009 8:34 pm
Subject: Re: How do you describe the fields in your database?
Hey Josh:

I think annotate_models is exactly what I'm looking for.  Giving it a
go can't hurt. :)

Cheers!

-Mark

On Nov 4, 12:28 pm, Josh Price <jos...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Bolton  
View profile  
 More options Nov 3 2009, 8:35 pm
From: Dave Bolton <davebol...@gmail.com>
Date: Wed, 4 Nov 2009 12:35:34 +1100
Local: Tues, Nov 3 2009 8:35 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

> Does anyone still use the annotate models plugin?

Yeah, loved it (taking noted mild annoyances into account). There's
been some small modifications by me and others too to make it a bit
more usable:
http://github.com/lightningdb/annotate_models

Cheers,
Dave


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan de Vries  
View profile  
 More options Nov 3 2009, 8:37 pm
From: Nathan de Vries <nat...@atnan.com>
Date: Wed, 4 Nov 2009 12:37:00 +1100
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?
On 04/11/2009, at 12:28 PM, Josh Price wrote:

> Does anyone still use the annotate models plugin?

I used to use a customised version of "rake model_annotations:update",  
which allowed you to place a comment next to each field that wouldn't  
get blown away if you re-ran the task. I then had a "rake  
model_annotations:missing" task which listed all models/fields with  
missing annotations. Useful in team environments, and if you can't  
express enough information in the name of the actual fields.

Cheers,

Nathan


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Healy  
View profile  
 More options Nov 3 2009, 8:38 pm
From: James Healy <ji...@deefa.com>
Date: Wed, 4 Nov 2009 12:38:02 +1100
Local: Tues, Nov 3 2009 8:38 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

Josh Price wrote:
> Does anyone still use the annotate models plugin?

> http://agilewebdevelopment.com/plugins/annotate_models

> It takes your schema and put it as a comment block at the top of your model
> classes. Combined with migration-based comments this might work for you.

> When I used this a while back I found keeping it up to date manually mildly
> annoying, but if your schema isn't going to change much then it might be a
> good solution.

I use it and find it handy for keeping a list of DB fields within easy
reach when working on a model. I don't think it currently extracts
fields comments from the DB however.

One minor irritation is that it doesn't interact nicely with files that
have a ruby 1.9 encoding statement (# coding: utf-8 and friends) at the
top of the file.

-- James Healy <ji...@deefa.com>  Wed, 04 Nov 2009 12:37:36 +1100


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josh Price  
View profile  
 More options Nov 3 2009, 9:27 pm
From: Josh Price <jos...@gmail.com>
Date: Wed, 4 Nov 2009 13:27:00 +1100
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

Yes field comment extraction would need to be added if someone hasn't
already done this.

Josh


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Cheail  
View profile  
 More options Nov 4 2009, 4:27 pm
From: Dan Cheail <dan.che...@me.com>
Date: Thu, 05 Nov 2009 08:27:10 +1100
Local: Wed, Nov 4 2009 4:27 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

>> Does anyone still use the annotate models plugin?

> Yeah, loved it (taking noted mild annoyances into account). There's
> been some small modifications by me and others too to make it a bit
> more usable:
> http://github.com/lightningdb/annotate_models

There's another fork of it, which has been re-packaged as a gem:

http://github.com/ctran/annotate_models

- Dan


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anthony Richardson  
View profile  
 More options Nov 4 2009, 5:46 pm
From: Anthony Richardson <goo...@anthonyrichardson.com>
Date: Thu, 5 Nov 2009 09:16:02 +1030
Local: Wed, Nov 4 2009 5:46 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

On Wed, Nov 4, 2009 at 11:49 AM, MarkBennett <mark.f.benn...@gmail.com> wrote:
> When you say most developers don't regularly check the schema.rb, how
> do you know what a model's fields are without doing this?

I have my SQL gui application open all the time where I can look at
everything as well as query the db. I never looked at schema.rb

Cheers,

Anthony


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel N  
View profile  
 More options Nov 4 2009, 5:47 pm
From: Daniel N <has....@gmail.com>
Date: Thu, 5 Nov 2009 09:47:56 +1100
Local: Wed, Nov 4 2009 5:47 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

On Thu, Nov 5, 2009 at 9:46 AM, Anthony Richardson <

goo...@anthonyrichardson.com> wrote:

> On Wed, Nov 4, 2009 at 11:49 AM, MarkBennett <mark.f.benn...@gmail.com>
> wrote:
> > When you say most developers don't regularly check the schema.rb, how
> > do you know what a model's fields are without doing this?

> I have my SQL gui application open all the time where I can look at
> everything as well as query the db. I never looked at schema.rb

> Cheers,

> Anthony

I use DataMapper where possible.  Everything is declared in the class.  Just
like real ruby!

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryan Bigg  
View profile  
 More options Nov 4 2009, 6:04 pm
From: Ryan Bigg <radarliste...@gmail.com>
Date: Thu, 5 Nov 2009 09:04:06 +1000
Local: Wed, Nov 4 2009 6:04 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

I store the database schema in my mind and know what every column's purpose
is.

2009/11/5 Daniel N <has....@gmail.com>

--
Ryan Bigg

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth Townsend  
View profile  
 More options Nov 4 2009, 6:14 pm
From: Gareth Townsend <gareth.towns...@me.com>
Date: Thu, 05 Nov 2009 10:14:44 +1100
Local: Wed, Nov 4 2009 6:14 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

On 05/11/2009, at 10:04 AM, Ryan Bigg wrote:

> I store the database schema in my mind and know what every column's  
> purpose is.

So you've never working on anything bigger than a blogging engine then?

Cheers,
Gareth Townsend
http://www.garethtownsend.info
http://www.melbournecocoaheads.com


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryan Bigg  
View profile  
 More options Nov 4 2009, 6:17 pm
From: Ryan Bigg <radarliste...@gmail.com>
Date: Thu, 5 Nov 2009 09:17:37 +1000
Local: Wed, Nov 4 2009 6:17 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

From: http://www.google.com.au/search?q=define%3A+joke

Definitions of * joke* on the Web:

   - a humorous anecdote or remark intended to provoke laughter; "he told a
   very funny joke"; "he knows a million gags"; "thanks for the laugh"; "he ...
   - jest: activity characterized by good humor
   - tell a joke; speak humorously; "He often jokes even when he appears
   serious"
   - antic: a ludicrous or grotesque act done for fun and amusement
   - act in a funny or teasing way
   - a triviality not to be taken seriously; "I regarded his campaign for
   mayor as a joke"

2009/11/5 Gareth Townsend <gareth.towns...@me.com>

--
Ryan Bigg

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian White  
View profile  
 More options Nov 4 2009, 6:18 pm
From: Ian White <ian.w.wh...@gmail.com>
Date: Wed, 4 Nov 2009 23:18:23 +0000
Local: Wed, Nov 4 2009 6:18 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

This thread makes me so wish I was going to railscamp :(

On 4 Nov 2009, at 23:17, Ryan Bigg wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryan Bigg  
View profile  
 More options Nov 4 2009, 6:18 pm
From: Ryan Bigg <radarliste...@gmail.com>
Date: Thu, 5 Nov 2009 09:18:34 +1000
Local: Wed, Nov 4 2009 6:18 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

However this is most likely the case for rboard.

2009/11/5 Ryan Bigg <radarliste...@gmail.com>

--
Ryan Bigg

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel N  
View profile  
 More options Nov 4 2009, 6:21 pm
From: Daniel N <has....@gmail.com>
Date: Thu, 5 Nov 2009 10:21:14 +1100
Local: Wed, Nov 4 2009 6:21 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

You're not coming :'(  We'll make sure there's plenty of alcohol consumed on
your behalf!


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lachie  
View profile  
 More options Nov 4 2009, 6:23 pm
From: Lachie <lach...@gmail.com>
Date: Thu, 5 Nov 2009 10:23:18 +1100
Local: Wed, Nov 4 2009 6:23 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?
a triviality not to be taken seriously; "I regarded his contribution
to the thread as a joke"

:lachie
http://plus2.com.au
http://smartbomb.com.au
http://www.flickr.com/photos/lachie/


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian White  
View profile  
 More options Nov 4 2009, 6:24 pm
From: Ian White <ian.w.wh...@gmail.com>
Date: Wed, 4 Nov 2009 23:24:58 +0000
Local: Wed, Nov 4 2009 6:24 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

MEXICAN

On 4 Nov 2009, at 23:21, Daniel N wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth Townsend  
View profile  
 More options Nov 4 2009, 6:27 pm
From: Gareth Townsend <gareth.towns...@me.com>
Date: Thu, 05 Nov 2009 10:27:29 +1100
Local: Wed, Nov 4 2009 6:27 pm
Subject: Re: [rails-oceania] Re: How do you describe the fields in your database?

Don't worry Ian, we'll hook up an internet connection and iChat over  
video, just so you can play along :)
On 05/11/2009, at 10:24 AM, Ian White wrote:

Cheers,
Gareth Townsend
http://www.garethtownsend.info
http://www.melbournecocoaheads.com

    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Chiha  
View profile  
 More options Nov 5 2009, 1:20 am
From: Brian Chiha <bch...@aioi.com.au>
Date: Thu, 5 Nov 2009 17:20:49 +1100
Local: Thurs, Nov 5 2009 1:20 am
Subject: RE: [rails-oceania] Re: How do you describe the fields in your database?
For what its worth,

RubyMine IDE has a 'Rails' view which along with class methods it will show model database fields.  It also can generate a Model dependency diagram showing model fields and relationships.. kind of like using railroad and dot

http://www.jetbrains.com/ruby/features/rails_editor.html

Brian.

-----Original Message-----
From: rails-oceania@googlegroups.com [mailto:rails-oceania@googlegroups.com] On Behalf Of Anthony Richardson
Sent: Thursday, 5 November 2009 9:46 AM
To: rails-oceania@googlegroups.com
Subject: [rails-oceania] Re: How do you describe the fields in your database?

On Wed, Nov 4, 2009 at 11:49 AM, MarkBennett <mark.f.benn...@gmail.com> wrote:
> When you say most developers don't regularly check the schema.rb, how
> do you know what a model's fields are without doing this?

I have my SQL gui application open all the time where I can look at
everything as well as query the db. I never looked at schema.rb

Cheers,

Anthony

This email is intended for the use of the individual or entity it is addressed to and may contain information that is confidential, legally privileged, commercially sensitive, or protected by copyright. If it contains financial product advice, the advice is of a general nature and you will need to determine how appropriate it is for you.

If you are not the intended recipient you must not disclose, disseminate, distribute or copy information contained in it. If you have received this e-mail in error, please notify the sender immediately and destroy the original message. While this mail and any attachments have been scanned for common computer viruses and found to be virus free, we recommend that you perform your own virus checks before opening any attachments.

___________________________________________________________________________ ___

This email has been scrubbed for your protection by SMX.
For more information visit http://smx.co.nz
___________________________________________________________________________ ___


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 26   Newer >
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google