I've never had that situation but I guess during the update phase you could 
rename the old column and then create the new one.  Then during the post 
migration phase you could copy and convert the data from the old column to the 
new one using EOs.  And then create a second migration that drops the old 
column.

That might save you from creating extra artifacts.

On Dec 16, 2012, at 11:43 AM, Theodore Petrosky <[email protected]> wrote:

> I may try that next time. However, there are times that I use migrations to 
> alter the database structure. Maybe there was an easier way, but I read a 
> column out to a file, created a new column of the type I wanted, read the 
> file and pushed the data into the new column, then dropped the old column.
> 
> Ted
> 
> 
> --- On Sun, 12/16/12, [email protected] <[email protected]> wrote:
> 
>> From: [email protected] <[email protected]>
>> Subject: Re: Simple question: inserting data right after table creation (on 
>> migration?)
>> To: "Johnny Miller" <[email protected]>
>> Cc: "James Cicenia" <[email protected]>, "WebObjects Development" 
>> <[email protected]>
>> Date: Sunday, December 16, 2012, 4:08 PM
>> Two additional
>> things about doing it in this method is that you have access
>> to EOF so you don't have to use the utilities or raw SQL
>> and it is run at the end of ALL migrations, so you know your
>> database will be completely migrated when your
>> PostMigrations are run.
>> SecretPal has some nice examples showing its
>> use.
>> David
>> On 2012-12-16, at 12:45 PM, Johnny Miller <[email protected]>
>> wrote:
>> You can also
>> make your migration file implement: IERXPostMigration
>> So in your normal migration do your
>> database changes and then in public void
>> postUpgrade(EOEditingContext editingContext, EOModel model)
>> do your inserts.
>> 
>> 
>> 
>> 
>>      
>>              
>>                      Aloha,
>>              
>>      
>>      
>>              
>>                      Mr. Johnny Miller
>> 
>>                      Web Development Manager
>> 
>>                      Kahalawai Media Company
>> 
>>                      Lahaina, HI 96761
>> 
>>                      tel: (808) 661-7962 | mobile: (808) 283-0791
>> 
>>                      website | e-mail
>>              
>>              
>>                      
>>                      
>>      
>> 
>> 
>> 
>> 
>> On Dec 16, 2012, at 4:34 AM, James Cicenia <[email protected]>
>> wrote:
>> I
>> have always created a second migration file with SQL
>> inserts. Haven't experienced any
>> problems.
>> DateModel0
>> ==> setup tables, etc.DateModel1
>> ==> bootstrap data sql inserts
>> 
>> 
>> 
>> 
>> On Dec 16, 2012, at 8:23 AM, Flavio Donadio <[email protected]>
>> wrote:
>> Hello, people!
>> 
>> 
>> I think I already know the answer, but I need to check
>> first...
>> 
>> I want to create a default user on my WO App when the app is
>> first run. So, I need to create a User entity and insert it
>> right after my tables are created, which is automatically
>> done through a migration.
>> 
>> Is it safe to insert my code right after this?
>> 
>>      userTable.create();
>>      userTable.setPrimaryKey("id");
>> 
>> Or would I need something else? Is this right, optimal
>> and/or safe?
>> 
>> 
>> Regards,
>> Flavio
>> _______________________________________________
>> 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/james%40jimijon.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/jlmiller%40kahalawai.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/programmingosx%40mac.com
>> 
>> This email sent to [email protected]
>> 
>> 
>> -----Inline Attachment Follows-----
>> 
>> 
>> _______________________________________________
>> 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/tedpet5%40yahoo.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