mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-24 08:46:48 +08:00
Updated Migration for CommonPartRecord and IdentityPartRecord (#8459)
This orders the operations differently than what is in dev for retrocompatibility in both environments.
This commit is contained in:
committed by
GitHub
parent
c5240678bd
commit
3b9c5fef06
@@ -34,6 +34,18 @@ namespace Orchard.Core.Common {
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_{nameof(CommonPartRecord.CreatedUtc)}", nameof(CommonPartRecord.CreatedUtc));
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_{nameof(CommonPartRecord.ModifiedUtc)}", nameof(CommonPartRecord.ModifiedUtc));
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_{nameof(CommonPartRecord.PublishedUtc)}", nameof(CommonPartRecord.PublishedUtc));
|
||||
// This originally in UpdateFrom8
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_Container_id", "Container_id");
|
||||
// This originally in UpdateFrom6
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_OwnedBy_ByCreation",
|
||||
nameof(CommonPartRecord.OwnerId),
|
||||
nameof(CommonPartRecord.CreatedUtc));
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_OwnedBy_ByModification",
|
||||
nameof(CommonPartRecord.OwnerId),
|
||||
nameof(CommonPartRecord.ModifiedUtc));
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_OwnedBy_ByPublication",
|
||||
nameof(CommonPartRecord.OwnerId),
|
||||
nameof(CommonPartRecord.PublishedUtc));
|
||||
});
|
||||
|
||||
SchemaBuilder.CreateTable("CommonPartVersionRecord",
|
||||
@@ -49,10 +61,13 @@ namespace Orchard.Core.Common {
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartVersionRecord)}_{nameof(CommonPartVersionRecord.PublishedUtc)}", nameof(CommonPartVersionRecord.PublishedUtc));
|
||||
});
|
||||
|
||||
SchemaBuilder.CreateTable("IdentityPartRecord",
|
||||
table => table
|
||||
SchemaBuilder
|
||||
.CreateTable("IdentityPartRecord",table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Identifier", column => column.WithLength(255))
|
||||
.Column<string>("Identifier", column => column.WithLength(255)))
|
||||
.AlterTable(nameof(IdentityPartRecord), table => table
|
||||
// This originally in UpdateFrom7
|
||||
.CreateIndex($"IDX_{nameof(IdentityPartRecord)}_{nameof(IdentityPartRecord.Identifier)}", nameof(IdentityPartRecord.Identifier))
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("BodyPart", builder => builder
|
||||
@@ -67,7 +82,7 @@ namespace Orchard.Core.Common {
|
||||
.Attachable()
|
||||
.WithDescription("Automatically generates a unique identity for the content item, which is required in import/export scenarios where one content item references another."));
|
||||
|
||||
return 6;
|
||||
return 9;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
@@ -177,5 +192,22 @@ namespace Orchard.Core.Common {
|
||||
});
|
||||
return 7;
|
||||
}
|
||||
|
||||
public int UpdateFrom7() {
|
||||
SchemaBuilder.AlterTable(nameof(IdentityPartRecord), table => table
|
||||
.CreateIndex($"IDX_{nameof(IdentityPartRecord)}_{nameof(IdentityPartRecord.Identifier)}", nameof(IdentityPartRecord.Identifier)));
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
public int UpdateFrom8() {
|
||||
// The Container_Id is basically a foreign key, used in several queries
|
||||
SchemaBuilder.AlterTable(nameof(CommonPartRecord), table => {
|
||||
table.CreateIndex($"IDX_{nameof(CommonPartRecord)}_Container_id",
|
||||
"Container_id");
|
||||
});
|
||||
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user