You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Øyvind Harboe <oy...@zylin.com> on 2008/08/27 08:25:57 UTC

Making columnOriginal and columnNew public

I need to figure out if a change to the database would cause data loss.

E.g. a user might *increase* the size of a text field and in this
case the model should be adapted to the new size. This allows
database managers some control over the database structure
from the comfort of e.g. MS SQL Manager.

If the model has a *larger* size of a text field, then I want to
update the database column to be larger.

I'm not sure I'm  a believer in an automatic way of handling
this since there could be a lot of application specific decisions
happening.

How about exposing the above two attributes in getColumnOriginal()
and getColumnNew()?

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Making columnOriginal and columnNew public

Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.

Done.

https://issues.apache.org/cayenne/browse/CAY-1100
http://svn.apache.org/viewvc?view=rev&revision=689594

Regards,
  - Tore.

On Aug 27, 2008, at 08:25, Øyvind Harboe wrote:

> I need to figure out if a change to the database would cause data  
> loss.
>
> E.g. a user might *increase* the size of a text field and in this
> case the model should be adapted to the new size. This allows
> database managers some control over the database structure
> from the comfort of e.g. MS SQL Manager.
>
> If the model has a *larger* size of a text field, then I want to
> update the database column to be larger.
>
> I'm not sure I'm  a believer in an automatic way of handling
> this since there could be a lot of application specific decisions
> happening.
>
> How about exposing the above two attributes in getColumnOriginal()
> and getColumnNew()?
>
> -- 
> Øyvind Harboe
> http://www.zylin.com/zy1000.html
> ARM7 ARM9 XScale Cortex
> JTAG debugger and flash programmer
>


RE: Making columnOriginal and columnNew public

Posted by Scott Anderson <sa...@airvana.com>.
> I'm leaning towards leaving this in the application domain....

I'd have to agree here; schema changes should always be touched by human
eyes, but the only way to do that effectively is at the application
level.

Re: Making columnOriginal and columnNew public

Posted by Øyvind Harboe <oy...@zylin.com>.
On Wed, Aug 27, 2008 at 10:32 AM, Tore Halset <ha...@pvv.ntnu.no> wrote:
> Hello.
>
> (This is related to merging)
>
> Another option to solve the same would be to create a
> AbstractToDbToken.mayRemoveInformation() that all ToDb tokens will have to
> implement? Need to find a better name. What do you think?

I think I would prefer the mayRemoveInformation() to be in a utility class
where I can copy and paste the code into the application if I need to
modify it...

Is there such a thing as a canonical definition of what "may remove
information" means?

For instance there may be *another* piece of code that does not use Cayenne
that would be harmed by such a change and therefore table X should not
be modified thus...

I'm leaning towards leaving this in the application domain....


-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Making columnOriginal and columnNew public

Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.

(This is related to merging)

Another option to solve the same would be to create a  
AbstractToDbToken.mayRemoveInformation() that all ToDb tokens will  
have to implement? Need to find a better name. What do you think?

Regards,
  - Tore.

On Aug 27, 2008, at 8:25 , Øyvind Harboe wrote:

> I need to figure out if a change to the database would cause data  
> loss.
>
> E.g. a user might *increase* the size of a text field and in this
> case the model should be adapted to the new size. This allows
> database managers some control over the database structure
> from the comfort of e.g. MS SQL Manager.
>
> If the model has a *larger* size of a text field, then I want to
> update the database column to be larger.
>
> I'm not sure I'm  a believer in an automatic way of handling
> this since there could be a lot of application specific decisions
> happening.
>
> How about exposing the above two attributes in getColumnOriginal()
> and getColumnNew()?
>
> -- 
> Øyvind Harboe
> http://www.zylin.com/zy1000.html
> ARM7 ARM9 XScale Cortex
> JTAG debugger and flash programmer
>