Skip to content

Commit

Permalink
Set index length limit for MySQL (#14500)
Browse files Browse the repository at this point in the history
Fix #14338
  • Loading branch information
MikeAlhayek committed Oct 13, 2023
1 parent cceb262 commit 6a958ca
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 272 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task<int> CreateAsync()
SchemaBuilder.AlterIndexTable<DashboardPartIndex>(table => table
.CreateIndex("IDX_DashboardPart_DocumentId",
"DocumentId",
nameof(DashboardPartIndex.Position))
"Position")
);

_contentDefinitionManager.AlterPartDefinition("DashboardPart", builder => builder
Expand All @@ -56,7 +56,7 @@ public int UpdateFrom2()
SchemaBuilder.AlterIndexTable<DashboardPartIndex>(table => table
.CreateIndex("IDX_DashboardPart_DocumentId",
"DocumentId",
nameof(DashboardPartIndex.Position))
"Position")
);

return 3;
Expand Down
3 changes: 0 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.Alias/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public int Create()
.Attachable()
.WithDescription("Provides a way to define custom aliases for content items."));

// NOTE: The Alias Length has been upgraded from 64 characters to 767.
// For existing SQL databases update the AliasPartIndex tables Alias column length manually.
// INFO: The Alias Length is now of 735 chars, but this is only used on a new installation.
SchemaBuilder.CreateMapIndexTable<AliasPartIndex>(table => table
.Column<string>("Alias", col => col.WithLength(AliasPart.MaxAliasLength))
.Column<string>("ContentItemId", c => c.WithLength(26))
Expand Down
21 changes: 10 additions & 11 deletions src/OrchardCore.Modules/OrchardCore.ArchiveLater/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using OrchardCore.ArchiveLater.Models;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.ContentManagement.Records;
using OrchardCore.Data.Migration;
using YesSql.Sql;

Expand All @@ -25,20 +24,20 @@ public int Create()
.WithDescription("Adds the ability to schedule content items to be archived at a given future date and time."));

SchemaBuilder.CreateMapIndexTable<ArchiveLaterPartIndex>(table => table
.Column<string>(nameof(ArchiveLaterPartIndex.ContentItemId))
.Column<DateTime>(nameof(ArchiveLaterPartIndex.ScheduledArchiveDateTimeUtc))
.Column<bool>(nameof(ArchiveLaterPartIndex.Published))
.Column<bool>(nameof(ArchiveLaterPartIndex.Latest))
.Column<string>("ContentItemId")
.Column<DateTime>("ScheduledArchiveDateTimeUtc")
.Column<bool>("Published")
.Column<bool>("Latest")
);

SchemaBuilder.AlterIndexTable<ArchiveLaterPartIndex>(table => table
.CreateIndex($"IDX_{nameof(ArchiveLaterPartIndex)}_{nameof(ContentItemIndex.DocumentId)}",
.CreateIndex("IDX_ArchiveLaterPartIndex_DocumentId",
"Id",
nameof(ContentItemIndex.DocumentId),
nameof(ArchiveLaterPartIndex.ContentItemId),
nameof(ArchiveLaterPartIndex.ScheduledArchiveDateTimeUtc),
nameof(ArchiveLaterPartIndex.Published),
nameof(ArchiveLaterPartIndex.Latest))
"DocumentId",
"ContentItemId",
"ScheduledArchiveDateTimeUtc",
"Published",
"Latest")
);

return 1;
Expand Down
14 changes: 7 additions & 7 deletions src/OrchardCore.Modules/OrchardCore.AuditTrail/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public int Create()
SchemaBuilder.AlterIndexTable<AuditTrailEventIndex>(table => table
.CreateIndex("IDX_AuditTrailEventIndex_DocumentId",
"DocumentId",
nameof(AuditTrailEventIndex.EventId),
nameof(AuditTrailEventIndex.Category),
nameof(AuditTrailEventIndex.Name),
nameof(AuditTrailEventIndex.CorrelationId),
nameof(AuditTrailEventIndex.UserId),
nameof(AuditTrailEventIndex.NormalizedUserName),
nameof(AuditTrailEventIndex.CreatedUtc)
"EventId",
"Category",
"Name",
"CorrelationId",
"UserId",
"NormalizedUserName",
"CreatedUtc"
),
collection: AuditTrailEvent.Collection
);
Expand Down
Loading

0 comments on commit 6a958ca

Please sign in to comment.