Re: [CDBI] add new columns to a table will break exi sting class?

Steven Mackenzie <steven.mackenzie-5/VXW7sOv/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Bill Moseley wrote:

>On Wed, May 24, 2006 at 11:36:15PM +0100, Matt S Trout wrote:
>  
>
>>Bill Moseley wrote:
>>    
>>
>>>On Wed, May 24, 2006 at 03:24:05PM +0100, Matt S Trout wrote:
>>>      
>>>
>>>>>No, you must have a primary key.
>>>>>          
>>>>>
>>>>You can often get round this by simply declaring the primary key as a 
>>>>composite of all columns - but it's very rare you *really* don't want a 
>>>>primary key. Usually lack of a primary key is just shoddy database design.
>>>>        
>>>>
>>>None of my link tables have a single primary key.
>>>
>>>   PersonRole->columns( Primary => qw / person role / );
>>>      
>>>
>>That's a single primary key.
>>
>>It just happens to be a primary key made up of two columns.
>>    
>>
>
>Yes, I misread your post.  I have seen examples of CDBI link tables
>that also have an integer primary key in addition to the link fields.
>  
>
I always add a single-column primary key, even to link tables, out of a recently-formed habit. I originally did it because I was told to by the person I was working for, which I resented. But I did notice that as I expanded the schema to encompass a larger problem domain, most of the link tables expanded to represent seperate domain entities. 

So now I put the "extra" primary key column just in case, because I don't think it really costs me anything. Does it?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.