diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs index 32475f4d21f..a14f315e0f7 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs @@ -48,6 +48,7 @@ public int Create() { .Column("Id", c => c.PrimaryKey().Identity()) .Column("PropertyName") .Column("Value", c => c.WithLength(4000)) + .Column("LatestValue", c => c.WithLength(4000)) .Column("FieldIndexPartRecord_Id") ); @@ -56,6 +57,7 @@ public int Create() { .Column("Id", c => c.PrimaryKey().Identity()) .Column("PropertyName") .Column("Value") + .Column("LatestValue") .Column("FieldIndexPartRecord_Id") ); @@ -64,6 +66,7 @@ public int Create() { .Column("Id", c => c.PrimaryKey().Identity()) .Column("PropertyName") .Column("Value") + .Column("LatestValue") .Column("FieldIndexPartRecord_Id") ); @@ -72,9 +75,28 @@ public int Create() { .Column("Id", c => c.PrimaryKey().Identity()) .Column("PropertyName") .Column("Value") + .Column("LatestValue") .Column("FieldIndexPartRecord_Id") ); + //Adds indexes for better performances in queries + SchemaBuilder.AlterTable("StringFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_StringFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_IntegerFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_DoubleFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_DecimalFieldIndexRecords", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.CreateTable("FieldIndexPartRecord", table => table.ContentPartRecord()); // Query @@ -89,6 +111,7 @@ public int Create() { SchemaBuilder.CreateTable("QueryPartRecord", table => table .ContentPartRecord() + .Column("VersionScope", c => c.WithLength(15)) ); SchemaBuilder.CreateTable("FilterGroupRecord", @@ -127,6 +150,7 @@ public int Create() { .Column("Description", c => c.WithLength(255)) .Column("State", c => c.Unlimited()) .Column("DisplayType", c => c.WithLength(64)) + .Column("GUIdentifier", column => column.WithLength(68)) .Column("Display") .Column("QueryPartRecord_id") .Column("GroupProperty_id") @@ -162,6 +186,7 @@ public int Create() { .Column("HideEmpty") .Column("RewriteOutput") + .Column("RewriteOutputCondition", c => c.Unlimited()) .Column("RewriteText", c => c.Unlimited()) .Column("StripHtmlTags") .Column("TrimLength") @@ -260,19 +285,6 @@ public int Create() { Description = T("The text from the Body part").Text }); - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table - .CreateIndex("IDX_Orchard_Projections_StringFieldIndexRecord", "FieldIndexPartRecord_Id") - ); - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table - .CreateIndex("IDX_Orchard_Projections_IntegerFieldIndexRecord", "FieldIndexPartRecord_Id") - ); - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table - .CreateIndex("IDX_Orchard_Projections_DoubleFieldIndexRecord", "FieldIndexPartRecord_Id") - ); - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table - .CreateIndex("IDX_Orchard_Projections_DecimalFieldIndexRecords", "FieldIndexPartRecord_Id") - ); - SchemaBuilder.CreateTable("NavigationQueryPartRecord", table => table.ContentPartRecord() .Column("Items") @@ -291,7 +303,7 @@ public int Create() { .WithIdentity() ); - return 4; + return 7; } public int UpdateFrom1() { @@ -314,7 +326,7 @@ public int UpdateFrom1() { ContentDefinitionManager.AlterTypeDefinition("ProjectionPage", cfg => cfg.Listable()); - return 3; + return 2; } public int UpdateFrom2() { @@ -336,29 +348,34 @@ public int UpdateFrom3() { public int UpdateFrom4() { SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table - .AddColumn("LatestValue", c => c.WithLength(4000))); + .AddColumn("LatestValue", c => c.WithLength(4000))); SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table - .AddColumn("LatestValue")); + .AddColumn("LatestValue")); SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table - .AddColumn("LatestValue")); + .AddColumn("LatestValue")); SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table - .AddColumn("LatestValue")); + .AddColumn("LatestValue")); //Adds indexes for better performances in queries - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("StringFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); - - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_PropertyName", new string[] { "PropertyName" })); - SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => table.CreateIndex("IX_FieldIndexPartRecord_Id", new string[] { "FieldIndexPartRecord_Id" })); + SchemaBuilder.AlterTable("StringFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_StringFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("IntegerFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_IntegerFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DoubleFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_DoubleFieldIndexRecord", "FieldIndexPartRecord_Id"); + }); + SchemaBuilder.AlterTable("DecimalFieldIndexRecord", table => { + table.CreateIndex("IDX_Orchard_Projections_PropertyName", "PropertyName"); + table.CreateIndex("IDX_Orchard_Projections_DecimalFieldIndexRecords", "FieldIndexPartRecord_Id"); + }); SchemaBuilder.AlterTable("QueryPartRecord", table => table .AddColumn("VersionScope", c => c.WithLength(15)));