Breaking changes in Projections Module

Topics: Announcements
Coordinator
Jan 10, 2012 at 7:40 PM
Edited Jan 12, 2012 at 11:02 PM

I am about to push some breaking changes on the Projections Module. If you install it on a running website, it will fail loading your current projections. The 1.x is not supposed to be used in production, but I know some of you are, because Projections is so awesome that you couldn't resist.

BACKUP

- Backup your DB

- Backup your Site

BACKUP AGAIN

- Backup your DB

- Backup your Site

 

If you care about keeping them though, I created a pseudo script so you can manually migrate them. However if you can start from scratch and recreate them from the editor I think it would be easier. To do so, delete every tables related to Orchard_Projections. Remove the Orchard_Framework_DataMigrationRecord targeting Projections. Then re-enable the module (actually if the module is enabled, the migrations will run automatically).

Otherwise:

- In the table [Orchard_Projections_FilterGroupRecord] create [QueryPartRecord_id] (int) and delete [QueryRecord_id]

- In the table [Orchard_Projections_SortCriterionRecord] create [QueryPartRecord_id] (int) and delete [QueryRecord_id]

- In the table [Orchard_Projections_LayoutRecord] create [QueryPartRecord_id] (int) and delete [QueryRecord_id]

- In the table [Orchard_Projections_ProjectionPartRecord] create [QueryPartRecord_id] (int) and delete [QueryRecord_id]

 

- Create a new table named [Orchard_Projections_QueryPartRecord] with

  - [Id] int, primary key, not null

 

- Add a new record in [Orchard_Framework_ContentTypeRecord] with values

  - Id: LEAVE EMPTY (auto generated)

  - Name: Query

  - Let {CONTENT_TYPE_ID} be the generated [Id]

 

- Add a record in  [Settings_ContentTypeDefinitionRecord] with values

  [Name] = Query            

  [DisplayName] = Query              

  [Hidden] =False             

  [Settings] = <settings /> 

 

  - Let {TYPE_DEFINITION_ID} be the newly created [Id]

 

- Add a record in [Settings_ContentPartDefinitionRecord] with values

  [Name] = QueryPart    

  [Hidden] = False            

  [Settings] = NULL

 

  - Let {PART_DEFINITION_ID} be the newly created [Id]

 

- Add a record in [Settings_ContentTypePartDefinitionRecord] with values

  [Settings] = <settings />

  [ContentTypeDefinitionRecord_id] = {TYPE_DEFINITION_ID}

  [ContentPartDefinitionRecord_id] = {PART_DEFINITION_ID}

 

- For each record in [Orchard_Projections_QueryRecord]

  - Let {QUERY_RECORD_ID} be the current value of [Id]

  - Let {QUERY_RECORD_NAME} be the current value of [Name]

  - Create a new record in [Orchard_Framework_ContentItemRecord], with [ContentType_id] = {CONTENT_TYPE_ID}

  - The generated id will be recalled as {CONTENT_ITEM_ID}

  - Create a new record in [Orchard_Framework_ContentItemVersionRecord] with

    [Number] = 1,

    [Published] = 1,

    [Latest] = 1,

    [Data] = NULL,

    [ContentItemRecord_id] = {CONTENT_ITEM_ID}

  - Let {CONTENT_VERSION_ID} be the [Id] of the new record

  - Create a new record in [Title_TitlePartRecord] with

    [Id] = {CONTENT_VERSION_ID}

    [ContentItemRecord_id] = {CONTENT_ITEM_ID}

    [Title] = {QUERY_RECORD_NAME}

  - In [Orchard_Projections_QueryPartRecord] add a new record with

   [Id] = {CONTENT_VERSION_ID}

  - In [Orchard_Projections_FilterGroupRecord] Replace {QUERY_RECORD_ID} by {CONTENT_VERSION_ID}

  - In [Orchard_Projections_SortCriterionRecord] Replace {QUERY_RECORD_ID} by {CONTENT_VERSION_ID}

  - In [Orchard_Projections_LayoutRecord] Replace {QUERY_RECORD_ID} by {CONTENT_VERSION_ID}

  - In [Orchard_Projections_ProjectionPartRecord] Replace {QUERY_RECORD_ID} by {CONTENT_VERSION_ID}

 

- Delete the table [Orchard_Projections_QueryRecord]

 

 

RUN THE NEW VERSION OF THE APPLICATION