Migration - steps to add a column to a record/part

Topics: Troubleshooting
Mar 25, 2011 at 12:19 PM

I added a 'description' (string) field to the ChapterPartRecord in the Chapters module.  I added the getter setter in the ChapterPart to call the Record.description. Nothing too magical there.

For the migration.cs I added....

        public int UpdateFrom1()
                 table => table
            return 2;

Ran the update.  I've confirmed the column was added in the database correctly.  While the property now shows when tracing the code, I cannot save or read from that column... so I'm troubleshooting.  Am I missing something in the migration.cs  ?  

Mar 26, 2011 at 1:34 AM

This should work just fine from what I can tell.

Mar 26, 2011 at 6:01 AM

Sorry, I should also answer on the correct forum, but here it is: you should add a dynamic field to the Chapter type which has been created specifically for your book. Each time you create a book, a new type is generated, which lets you customize it's chapters.

Mar 26, 2011 at 6:31 PM

Okay thank you for confirming that bertrandleroy.  My goal was to confirm the steps for proper migration within Orchard *in general* using the simple case of adding a field.  Most documentation on migration is scattered throughout various examples focused on doing things other than migration so I wasn't sure I had the complete picture.  

Now I see the problem is related to the particular module.   I hadn't concidered that angle when I posted.  Thanks for clarifying that sebastienross.