Thanks Fabian.

Can one use ERXMigration to add a serial column? I don’t think it is a JDBC 
column type? I can create an integer column and then add the serial default 
value in SQL presumably. I suspect there isn’t a database agnostic way to do 
this.

I’ll try that. Thank you again,

Mark

> On 2 Oct 2014, at 10:43, Fabian Peters <[email protected]> wrote:
> 
> Hi Mark,
> 
> For postgresql you could add a column "serial". When the column is added, it 
> is populated with values by postgres. You could then use migration's 
> "setPrimaryKey" and "dropPrimaryKey".
> 
> This is totally untested…
> 
> Fabian
> 
> Am 02.10.2014 um 11:00 schrieb Mark Wardle <[email protected]>:
> 
>> Dear all,
>> 
>> I need to add a new primary key to a table that already contains data. 
>> 
>> Is it possible to use migrations to add this and have the column 
>> auto-populated with a serial number?
>> 
>> My other plan was to create an integer column and then, in code, iterate 
>> through the objects manually setting the serial integer, and then later on 
>> migrating that to a primary key. Would this then break primary key 
>> generation for newly created objects?
>> 
>> All advice appreciated!
>> 
>> Many thanks,
>> 
>> Mark
>> 
>> 
>> -- 
>> Dr. Mark Wardle
>> Consultant Neurologist, University Hospital Wales, Cardiff, UK
>> Email: [email protected] or [email protected]  Twitter: @mwardle
>> Telephone: 02920745274 (secretary) or facsimile: 02920744166
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
>> 
>> This email sent to [email protected]
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to