From f6366f93aca12668d65f7f969284c39a6d12db3e Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 17 Oct 2023 08:37:58 -0700 Subject: [PATCH] Fix MySQL index length --- .../OrchardCore.Cms.Web.csproj | 1 + src/OrchardCore.Cms.Web/Recipes/.placeholder | 1 + .../Indexing/SQL/Migrations.cs | 111 +- .../Indexing/SQL/UserPickerMigrations.cs | 4 +- .../OrchardCore.Indexing/Migrations.cs | 8 +- .../OrchardCore.Layers/Migrations.cs | 9 +- .../OrchardCore.Lists/Migrations.cs | 5 +- .../OrchardCore.Taxonomies/Migrations.cs | 16 +- .../YesSql/Migrations/OpenIdMigrations.cs | 4 +- .../cms-tests/Recipes/migrations.recipe.json | 1326 +++++++++++++++++ .../cypress/integration/000-saas-setup.js | 1 - .../cypress/integration/agency-test.js | 4 +- .../cypress/integration/blog-test.js | 2 +- .../cypress/integration/comingsoon-test.js | 2 +- .../cypress/integration/headless-test.js | 2 +- .../cypress/integration/migrations-test.js | 24 + .../cypress/integration/sass-test.js | 2 +- .../cypress-commands/dist/test-runner.js | 9 + .../OrchardCore.Tests.csproj | 6 +- 19 files changed, 1459 insertions(+), 78 deletions(-) create mode 100644 src/OrchardCore.Cms.Web/Recipes/.placeholder create mode 100644 test/OrchardCore.Tests.Functional/cms-tests/Recipes/migrations.recipe.json create mode 100644 test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/migrations-test.js diff --git a/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj b/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj index a5ac7fee774..7016f37e165 100644 --- a/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj +++ b/src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj @@ -27,6 +27,7 @@ + diff --git a/src/OrchardCore.Cms.Web/Recipes/.placeholder b/src/OrchardCore.Cms.Web/Recipes/.placeholder new file mode 100644 index 00000000000..a8cfe7d6197 --- /dev/null +++ b/src/OrchardCore.Cms.Web/Recipes/.placeholder @@ -0,0 +1 @@ +# This file is used to ensure the Recipe folder is created diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/Migrations.cs index 2ed39e9b409..bae1345495c 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/Migrations.cs @@ -43,7 +43,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TextFieldIndex_DocumentId_ContentType", "DocumentId", @@ -54,10 +54,12 @@ public int Create() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Text (764) + Published and Latest (1) = 767 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TextFieldIndex_DocumentId_Text", "DocumentId", - "Text", + "Text(764)", "Published", "Latest") ); @@ -83,7 +85,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Boolean (1) + Published (1) + Latest (1) = 767 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Boolean, Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_BooleanFieldIndex_DocumentId_ContentType", "DocumentId", @@ -116,7 +118,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_NumericFieldIndex_DocumentId_ContentType", "DocumentId", @@ -156,7 +158,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_DateTimeFieldIndex_DocumentId_ContentType", "DocumentId", @@ -196,7 +198,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_DateFieldIndex_DocumentId_ContentType", "DocumentId", @@ -237,7 +239,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_ContentPickerFieldIndex_DocumentId_ContentType", "DocumentId", @@ -277,7 +279,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TimeFieldIndex_DocumentId_ContentType", "DocumentId", @@ -325,7 +327,7 @@ public int Create() // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_LinkFieldIndex_DocumentId_ContentType", "DocumentId", @@ -336,18 +338,22 @@ public int Create() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Url (764) + Published and Latest (1) = 767 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_LinkFieldIndex_DocumentId_Url", "DocumentId", - "Url", + "Url(764)", "Published", "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Text (764) + Published and Latest (1) = 767 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_LinkFieldIndex_DocumentId_Text", "DocumentId", - "Text", + "Text(764)", "Published", "Latest") ); @@ -373,7 +379,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_HtmlFieldIndex_DocumentId_ContentType", "DocumentId", @@ -406,7 +412,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_MultiTextFieldIndex_DocumentId_ContentType", "DocumentId", @@ -417,10 +423,12 @@ public int Create() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Value (764) + Published and Latest (1) = 767 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_MultiTextFieldIndex_DocumentId_Value", "DocumentId", - "Value", + "Value(764)", "Published", "Latest") ); @@ -472,7 +480,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TextFieldIndex_DocumentId_ContentType", "DocumentId", @@ -483,14 +491,15 @@ public int UpdateFrom3() "Latest") ); - // Can't be created on existing databases where the 'Text' may be of 768 chars. - //SchemaBuilder.AlterIndexTable(table => table - // .CreateIndex("IDX_TextFieldIndex_DocumentId_Text", - // "DocumentId", - // "Text", - // "Published", - // "Latest") - //); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Text (764) + Published and Latest (1) = 767 (< 768). + SchemaBuilder.AlterIndexTable(table => table + .CreateIndex("IDX_TextFieldIndex_DocumentId_Text", + "DocumentId", + "Text(764)", + "Published", + "Latest") + ); SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_BooleanFieldIndex_DocumentId", @@ -502,7 +511,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Boolean, Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_BooleanFieldIndex_DocumentId_ContentType", "DocumentId", @@ -524,7 +533,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_NumericFieldIndex_DocumentId_ContentType", "DocumentId", @@ -553,7 +562,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_DateTimeFieldIndex_DocumentId_ContentType", "DocumentId", @@ -582,7 +591,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_DateFieldIndex_DocumentId_ContentType", "DocumentId", @@ -611,7 +620,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_ContentPickerFieldIndex_DocumentId_ContentType", "DocumentId", @@ -640,7 +649,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TimeFieldIndex_DocumentId_ContentType", "DocumentId", @@ -669,7 +678,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_LinkFieldIndex_DocumentId_ContentType", "DocumentId", @@ -680,23 +689,25 @@ public int UpdateFrom3() "Latest") ); - // Can't be created on existing databases where the 'Url' may be of 768 chars. - //SchemaBuilder.AlterIndexTable(table => table - // .CreateIndex("IDX_LinkFieldIndex_DocumentId_Url", - // "DocumentId", - // "Url", - // "Published", - // "Latest") - //); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Url (764) + Published and Latest (1) = 767 (< 768). + SchemaBuilder.AlterIndexTable(table => table + .CreateIndex("IDX_LinkFieldIndex_DocumentId_Url", + "DocumentId", + "Url(764)", + "Published", + "Latest") + ); - // Can't be created on existing databases where the 'Text' may be of 768 chars. - //SchemaBuilder.AlterIndexTable(table => table - // .CreateIndex("IDX_LinkFieldIndex_DocumentId_Text", - // "DocumentId", - // "Text", - // "Published", - // "Latest") - //); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Text (764) + Published and Latest (1) = 767 (< 768). + SchemaBuilder.AlterIndexTable(table => table + .CreateIndex("IDX_LinkFieldIndex_DocumentId_Text", + "DocumentId", + "Text(764)", + "Published", + "Latest") + ); SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_HtmlFieldIndex_DocumentId", @@ -708,7 +719,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_HtmlFieldIndex_DocumentId_ContentType", "DocumentId", @@ -729,7 +740,7 @@ public int UpdateFrom3() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_MultiTextFieldIndex_DocumentId_ContentType", "DocumentId", @@ -740,10 +751,12 @@ public int UpdateFrom3() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + Value (764) + Published and Latest (1) = 767 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_MultiTextFieldIndex_DocumentId_Value", "DocumentId", - "Value", + "Value(764)", "Published", "Latest") ); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerMigrations.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerMigrations.cs index 8dd1e525174..27afa32bfd5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerMigrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerMigrations.cs @@ -31,7 +31,7 @@ public int Create() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_UserPickerFieldIndex_DocumentId_ContentType", "DocumentId", @@ -67,7 +67,7 @@ public int UpdateFrom1() ); // The index in MySQL can accommodate up to 768 characters or 3072 bytes. - // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published (1) + Latest (1) = 766 (less than 768) + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_UserPickerFieldIndex_DocumentId_ContentType", "DocumentId", diff --git a/src/OrchardCore.Modules/OrchardCore.Indexing/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Indexing/Migrations.cs index 647cf0119ec..6c512a604a2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Indexing/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Indexing/Migrations.cs @@ -8,10 +8,10 @@ public class Migrations : DataMigration public int Create() { SchemaBuilder.CreateTable(nameof(IndexingTask), table => table - .Column(nameof(IndexingTask.Id), col => col.PrimaryKey().Identity()) - .Column(nameof(IndexingTask.ContentItemId), c => c.WithLength(26)) - .Column(nameof(IndexingTask.CreatedUtc), col => col.NotNull()) - .Column(nameof(IndexingTask.Type)) + .Column("Id", col => col.PrimaryKey().Identity()) + .Column("ContentItemId", c => c.WithLength(26)) + .Column("CreatedUtc", col => col.NotNull()) + .Column("Type") ); SchemaBuilder.AlterTable(nameof(IndexingTask), table => table diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs index 3e09d60684c..510c484d6d4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Migrations.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using OrchardCore.Data.Migration; using OrchardCore.Layers.Indexes; @@ -31,7 +30,9 @@ public int Create() ); SchemaBuilder.AlterIndexTable(table => table - .CreateIndex("IDX_LayerMetadataIndex_DocumentId", "DocumentId", "Zone") + .CreateIndex("IDX_LayerMetadataIndex_DocumentId", + "DocumentId", + "Zone") ); // Shortcut other migration steps on new content definition schemas. @@ -42,7 +43,9 @@ public int Create() public int UpdateFrom1() { SchemaBuilder.AlterIndexTable(table => table - .CreateIndex("IDX_LayerMetadataIndex_DocumentId", "DocumentId", "Zone") + .CreateIndex("IDX_LayerMetadataIndex_DocumentId", + "DocumentId", + "Zone") ); return 2; diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Migrations.cs index 4aa7a1bcd3e..3aace78dcf7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Migrations.cs @@ -63,7 +63,10 @@ public int UpdateFrom1() public int UpdateFrom2() { SchemaBuilder.AlterIndexTable(table => table - .CreateIndex("IDX_ContainedPartIndex_DocumentId", "DocumentId", "ListContentItemId", "Order") + .CreateIndex("IDX_ContainedPartIndex_DocumentId", + "DocumentId", + "ListContentItemId", + "Order") ); return 3; diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Migrations.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Migrations.cs index bbcd88adc4b..fc013ffc5f9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Migrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Migrations.cs @@ -63,12 +63,14 @@ public int Create() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TaxonomyIndex_DocumentId_ContentType", "DocumentId", - "ContentType", - "ContentPart", - "ContentField", + "ContentType(254)", + "ContentPart(254)", + "ContentField(254)", "Published", "Latest") ); @@ -125,12 +127,14 @@ public int UpdateFrom3() "Latest") ); + // The index in MySQL can accommodate up to 768 characters or 3072 bytes. + // DocumentId (2) + ContentType (254) + ContentPart (254) + ContentField (254) + Published and Latest (1) = 765 (< 768). SchemaBuilder.AlterIndexTable(table => table .CreateIndex("IDX_TaxonomyIndex_DocumentId_ContentType", "DocumentId", - "ContentType", - "ContentPart", - "ContentField", + "ContentType(254)", + "ContentPart(254)", + "ContentField(254)", "Published", "Latest") ); diff --git a/src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Migrations/OpenIdMigrations.cs b/src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Migrations/OpenIdMigrations.cs index 9432e32024d..5d7180e0d52 100644 --- a/src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Migrations/OpenIdMigrations.cs +++ b/src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Migrations/OpenIdMigrations.cs @@ -25,8 +25,8 @@ public OpenIdMigrations(ISession session) public int Create() { SchemaBuilder.CreateMapIndexTable(table => table - .Column(nameof(OpenIdApplicationIndex.ApplicationId), column => column.WithLength(48)) - .Column(nameof(OpenIdApplicationIndex.ClientId), column => column.Unique()), + .Column("ApplicationId", column => column.WithLength(48)) + .Column("ClientId", column => column.Unique()), collection: OpenIdApplicationCollection); SchemaBuilder.AlterIndexTable(table => table diff --git a/test/OrchardCore.Tests.Functional/cms-tests/Recipes/migrations.recipe.json b/test/OrchardCore.Tests.Functional/cms-tests/Recipes/migrations.recipe.json new file mode 100644 index 00000000000..2809ab01e75 --- /dev/null +++ b/test/OrchardCore.Tests.Functional/cms-tests/Recipes/migrations.recipe.json @@ -0,0 +1,1326 @@ +{ + "name": "Migrations", + "displayName": "Migrations", + "description": "Test features having database migrations.", + "author": "The Orchard Core Team", + "website": "https://orchardcore.net", + "version": "1.0.0", + "issetuprecipe": true, + "categories": [ "tests" ], + "tags": [ "tests" ], + + // The variables are evaluated the first time they are accessed, and reused across steps + "variables": { + "adminUrlPrefix": "[js: configuration('OrchardCore_Admin:AdminUrlPrefix', 'Admin')]", + "blogContentItemId": "[js:uuid()]", + "menuContentItemId": "[js:uuid()]", + "tagsContentItemId": "[js:uuid()]", + "tagContentItemId": "[js:uuid()]", + "earthTagContentItemId": "[js:uuid()]", + "explorationTagContentItemId": "[js:uuid()]", + "spaceTagContentItemId": "[js:uuid()]", + "categoriesContentItemId": "[js:uuid()]", + "categoryTravelContentItemId": "[js:uuid()]" + // "now": "[js: new Date().toISOString()]" + }, + + "steps": [ + { + "name": "feature", + "enable": [ + // SaaS + "OrchardCore.HomeRoute", + "OrchardCore.Admin", + "OrchardCore.Diagnostics", + "OrchardCore.DynamicCache", + "OrchardCore.Features", + "OrchardCore.Navigation", + "OrchardCore.Recipes", + "OrchardCore.Resources", + "OrchardCore.Roles", + "OrchardCore.Security", + "OrchardCore.Settings", + "OrchardCore.Themes", + "OrchardCore.Users", + + // Content Management + "OrchardCore.Alias", + "OrchardCore.AdminMenu", + "OrchardCore.Autoroute", + "OrchardCore.Html", + "OrchardCore.ContentFields", + "OrchardCore.ContentPreview", + "OrchardCore.Contents", + "OrchardCore.ContentTypes", + "OrchardCore.CustomSettings", + "OrchardCore.Deployment", + "OrchardCore.Deployment.Remote", + "OrchardCore.Feeds", + "OrchardCore.Flows", + "OrchardCore.Indexing", + "OrchardCore.Layers", + "OrchardCore.Lists", + "OrchardCore.Markdown", + "OrchardCore.Media", + "OrchardCore.Menu", + "OrchardCore.Placements", + "OrchardCore.Queries", + "OrchardCore.Queries.Sql", + "OrchardCore.Shortcodes.Templates", + "OrchardCore.Rules", + "OrchardCore.Taxonomies", + "OrchardCore.Title", + "OrchardCore.Templates", + "OrchardCore.Widgets", + + // Features having database migrations. + "OrchardCore.AdminDashboard", + "OrchardCore.Alias", + "OrchardCore.ArchiveLater", + "OrchardCore.AuditTrail", + "OrchardCore.Autoroute", + "OrchardCore.ContentFields.Indexing.SQL", + "OrchardCore.ContentFields.Indexing.SQL.UserPicker", + "OrchardCore.ContentLocalization", + "OrchardCore.Indexing", + "OrchardCore.Layers", + "OrchardCore.Lists", + "OrchardCore.Notifications", + "OrchardCore.OpenId", + "OrchardCore.PublishLater", + "OrchardCore.Taxonomies", + "OrchardCore.Workflows", + + // Themes + "TheBlogTheme", + "TheAdmin", + "SafeMode" + ] + }, + { + "name": "themes", + "admin": "TheAdmin", + "site": "TheBlogTheme" + }, + { + "name": "Roles", + "Roles": [ + { + "Name": "Administrator", + "Description": "Administrator", + "Permissions": [] + }, + { + "Name": "Moderator", + "Description": "Moderator", + "Permissions": [] + }, + { + "Name": "Editor", + "Description": "Editor", + "Permissions": [] + }, + { + "Name": "Author", + "Description": "Author", + "Permissions": [] + }, + { + "Name": "Contributor", + "Description": "Contributor", + "Permissions": [] + }, + { + "Name": "Authenticated", + "Description": "Authenticated", + "Permissions": [] + }, + { + "Name": "Anonymous", + "Description": "Anonymous", + "Permissions": [] + } + ] + }, + { + "name": "settings", + "HomeRoute": { + "Action": "Display", + "Controller": "Item", + "Area": "OrchardCore.Contents", + "ContentItemId": "[js: variables('blogContentItemId')]" + }, + "LayerSettings": { + "Zones": [ "Content", "Footer" ] + } + }, + { + "name": "ContentDefinition", + "ContentTypes": [ + { + "Name": "Article", + "DisplayName": "Article", + "Hidden": false, + "Settings": { + "ContentTypeSettings": { + "Creatable": true, + "Draftable": true, + "Versionable": true, + "Listable": true + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Article", + "Name": "Article", + "Settings": { + "ContentTypePartSettings": { + "Position": "3" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | display_text | slugify }}", + "ShowHomepageOption": true + }, + "ContentTypePartSettings": { + "Position": "1" + } + } + }, + { + "PartName": "HtmlBodyPart", + "Name": "HtmlBodyPart", + "Settings": { + "ContentTypePartSettings": { + "Editor": "Wysiwyg", + "Position": "2" + } + } + }, + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "BlogPost", + "DisplayName": "Blog Post", + "Hidden": false, + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + }, + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | container | display_text | slugify }}/{{ Model.ContentItem | display_text | slugify }}", + "ShowHomepageOption": false + } + } + }, + { + "PartName": "BlogPost", + "Name": "BlogPost", + "Settings": { + "ContentTypePartSettings": { + "Position": "3" + } + } + }, + { + "PartName": "MarkdownBodyPart", + "Name": "MarkdownBodyPart", + "Settings": { + "ContentTypePartSettings": { + "Editor": "Wysiwyg", + "Position": "2" + } + } + } + ] + }, + { + "Name": "Blog", + "DisplayName": "Blog", + "Hidden": false, + "Settings": { + "ContentTypeSettings": { + "Creatable": true, + "Draftable": true, + "Versionable": true, + "Listable": true, + "Securable": true + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + }, + "LuceneContentIndexSettings": { + "Included": false, + "Stored": false, + "Keyword": false + }, + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | display_text | slugify }}", + "ShowHomepageOption": true + } + } + }, + { + "PartName": "Blog", + "Name": "Blog", + "Settings": { + "ContentTypePartSettings": { + "Position": "3" + } + } + }, + { + "PartName": "HtmlBodyPart", + "Name": "HtmlBodyPart", + "Settings": { + "ContentTypePartSettings": { + "Position": "2" + } + } + }, + { + "PartName": "ListPart", + "Name": "ListPart", + "Settings": { + "ContentTypePartSettings": { + "Position": "4" + }, + "ListPartSettings": { + "PageSize": 10, + "ContainedContentTypes": [ + "BlogPost" + ] + } + } + } + ] + }, + { + "Name": "Container", + "DisplayName": "Container", + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true, + "Securable": true, + "Stereotype": "Widget" + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Container", + "Name": "Container", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + }, + { + "PartName": "FlowPart", + "Name": "FlowPart", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + } + } + } + ] + }, + { + "Name": "Blockquote", + "DisplayName": "Blockquote", + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true, + "Securable": true, + "Stereotype": "Widget" + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Blockquote", + "Name": "Blockquote", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "Image", + "DisplayName": "Image", + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true, + "Securable": true, + "Stereotype": "Widget" + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Image", + "Name": "Image", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "Paragraph", + "DisplayName": "Paragraph", + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true, + "Securable": true, + "Stereotype": "Widget" + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Paragraph", + "Name": "Paragraph", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "RawHtml", + "DisplayName": "Raw Html", + "Settings": { + "ContentTypeSettings": { + "Draftable": true, + "Versionable": true, + "Securable": true, + "Stereotype": "Widget" + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "RawHtml", + "Name": "RawHtml", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "Page", + "DisplayName": "Page", + "Settings": { + "ContentTypeSettings": { + "Creatable": true, + "Draftable": true, + "Versionable": true, + "Listable": true, + "Securable": true + } + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Page", + "Name": "Page", + "Settings": { + "ContentTypePartSettings": { + "Position": "3" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + }, + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | display_text | slugify }}", + "ShowHomepageOption": true + } + } + }, + { + "PartName": "FlowPart", + "Name": "FlowPart", + "Settings": { + "ContentTypePartSettings": { + "Position": "2" + } + } + }, + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + } + ] + }, + { + "Name": "Tag", + "DisplayName": "Tag", + "Settings": { + "ContentTypeSettings": {}, + "FullTextAspectSettings": {} + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Tag", + "Name": "Tag", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + } + } + }, + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "2" + }, + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | display_text | slugify }}", + "ManageContainedItemRoutes": true + } + } + } + ] + }, + { + "Name": "Category", + "DisplayName": "Category", + "Settings": { + "ContentTypeSettings": {}, + "FullTextAspectSettings": {} + }, + "ContentTypePartDefinitionRecords": [ + { + "PartName": "Category", + "Name": "Category", + "Settings": { + "ContentTypePartSettings": { + "Position": "1" + } + } + }, + { + "PartName": "TitlePart", + "Name": "TitlePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "0" + } + } + }, + { + "PartName": "AutoroutePart", + "Name": "AutoroutePart", + "Settings": { + "ContentTypePartSettings": { + "Position": "2" + }, + "AutoroutePartSettings": { + "AllowCustomPath": true, + "Pattern": "{{ Model.ContentItem | display_text | slugify }}", + "ManageContainedItemRoutes": true + } + } + } + ] + } + ], + "ContentParts": [ + { + "Name": "Blog", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "MediaField", + "Name": "Image", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Banner Image", + "Position": "0" + }, + "LuceneContentIndexSettings": { + "Included": false, + "Stored": false, + "Keyword": false + }, + "MediaFieldSettings": { + "Multiple": false, + "AllowAnchors": true + } + } + } + ] + }, + { + "Name": "BlogPost", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "TextField", + "Name": "Subtitle", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Subtitle", + "Position": "0" + } + } + }, + { + "FieldName": "MediaField", + "Name": "Image", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Banner Image", + "Position": "1" + }, + "LuceneContentIndexSettings": { + "Included": false, + "Stored": false, + "Keyword": false + }, + "MediaFieldSettings": { + "Multiple": false, + "AllowAnchors": true + } + } + }, + { + "FieldName": "TaxonomyField", + "Name": "Tags", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Tags", + "Editor": "Tags", + "DisplayMode": "Tags", + "Position": "2" + }, + "TaxonomyFieldSettings": { + "TaxonomyContentItemId": "[js: variables('tagsContentItemId')]" + }, + "TaxonomyFieldTagsEditorSettings": {} + } + }, + { + "FieldName": "TaxonomyField", + "Name": "Category", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Category", + "Position": "3" + }, + "TaxonomyFieldSettings": { + "TaxonomyContentItemId": "[js: variables('categoriesContentItemId')]", + "Unique": true, + "LeavesOnly": true + } + } + } + ] + }, + { + "Name": "Article", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "TextField", + "Name": "Subtitle", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Subtitle", + "Position": "0" + } + } + }, + { + "FieldName": "MediaField", + "Name": "Image", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Banner Image", + "Position": "0" + }, + "MediaFieldSettings": { + "Multiple": false, + "AllowAnchors": true + } + } + } + ] + }, + { + "Name": "Blockquote", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "TextField", + "Name": "Quote", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Quote", + "Editor": "TextArea", + "Position": "0" + } + } + } + ] + }, + { + "Name": "Image", + "Settings": { + "Attachable": true + }, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "MediaField", + "Name": "Media", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Image", + "Position": "0" + }, + "MediaFieldSettings": { + "Multiple": false, + "Required": true + } + } + }, + { + "FieldName": "TextField", + "Name": "Caption", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Caption", + "Position": "1" + }, + "TextFieldSettings": { + "Hint": "A description of the image used as title or alternate text" + } + } + } + ] + }, + { + "Name": "Paragraph", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "HtmlField", + "Name": "Content", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Content", + "Position": "0", + "Editor": "Wysiwyg" + } + } + } + ] + }, + { + "Name": "RawHtml", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "HtmlField", + "Name": "Content", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Content", + "Position": "0", + "Editor": "Multiline" + } + } + } + ] + }, + { + "Name": "Category", + "Settings": {}, + "ContentPartFieldDefinitionRecords": [ + { + "FieldName": "TextField", + "Name": "Icon", + "Settings": { + "ContentPartFieldSettings": { + "DisplayName": "Icon", + "Editor": "IconPicker", + "Position": "0" + }, + "TextFieldSettings": { + "Required": true + } + } + } + ] + } + ] + }, + { + "name": "content", + "Data": [ + { + "ContentType": "Menu", + "ContentItemId": "[js: variables('menuContentItemId')]", + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "DisplayText": "Main Menu", + "Latest": true, + "Published": true, + "MenuPart": {}, + "TitlePart": { + "Title": "Main Menu" + }, + "MenuItemsListPart": { + "MenuItems": [ + { + "ContentType": "LinkMenuItem", + "ContentItemId": "[js: uuid()]", + "DisplayText": "Home", + "LinkMenuItemPart": { + "Name": "Home", + "Url": "~/" + } + }, + { + "ContentType": "LinkMenuItem", + "ContentItemId": "[js: uuid()]", + "DisplayText": "About", + "LinkMenuItemPart": { + "Name": "About", + "Url": "~/about" + } + } + ] + }, + "AliasPart": { + "Alias": "main-menu" + } + }, + { + "ContentItemId": "[js: variables('tagsContentItemId')]", + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "ContentType": "Taxonomy", + "DisplayText": "Tags", + "Latest": true, + "Published": true, + "TitlePart": { + "Title": "Tags" + }, + "AliasPart": { + "Alias": "tags" + }, + "TaxonomyPart": { + "Terms": [ + { + "ContentItemId": "[js: variables('earthTagContentItemId')]", + "ContentType": "Tag", + "DisplayText": "Earth", + "TitlePart": { + "Title": "Earth" + }, + "AutoroutePart": { + "Path": "earth" + }, + "TermPart": { + "TaxonomyContentItemId": "[js: variables('tagsContentItemId')]" + } + }, + { + "ContentItemId": "[js: variables('explorationTagContentItemId')]", + "ContentType": "Tag", + "DisplayText": "Exploration", + "TitlePart": { + "Title": "Exploration" + }, + "AutoroutePart": { + "Path": "exploration" + }, + "TermPart": { + "TaxonomyContentItemId": "[js: variables('tagsContentItemId')]" + } + }, + { + "ContentItemId": "[js: variables('spaceTagContentItemId')]", + "ContentType": "Tag", + "DisplayText": "Space", + "TitlePart": { + "Title": "Space" + }, + "AutoroutePart": { + "Path": "space" + }, + "TermPart": { + "TaxonomyContentItemId": "[js: variables('tagsContentItemId')]" + } + } + ], + "TermContentType": "Tag" + }, + "AutoroutePart": { + "Path": "tags", + "RouteContainedItems": true + } + }, + { + "ContentItemId": "[js: variables('categoriesContentItemId')]", + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "ContentType": "Taxonomy", + "DisplayText": "Categories", + "Latest": true, + "Published": true, + "TitlePart": { + "Title": "Categories" + }, + "AliasPart": { + "Alias": "categories" + }, + "TaxonomyPart": { + "Terms": [ + { + "ContentItemId": "[js: variables('categoryTravelContentItemId')]", + "ContentType": "Category", + "DisplayText": "Travel", + "Category": { + "Icon": { + "Text": "fas fa-globe-americas" + } + }, + "TitlePart": { + "Title": "Travel" + }, + "AutoroutePart": { + "Path": "travel" + }, + "TermPart": { + "TaxonomyContentItemId": "[js: variables('categoriesContentItemId')]" + } + } + ], + "TermContentType": "Category" + }, + "AutoroutePart": { + "Path": "categories", + "RouteContainedItems": true + } + }, + { + "ContentType": "Blog", + "ContentItemId": "[js: variables('blogContentItemId')]", + "DisplayText": "Blog", + "Latest": true, + "Published": true, + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "TitlePart": { + "Title": "Blog" + }, + "HtmlBodyPart": { + "Html": "This is the description of your blog" + }, + "AutoroutePart": { + "Path": "blog" + }, + "ListPart": {}, + "Blog": { + "Image": { + "Paths": [ + "home-bg.jpg" + ], + "MediaTexts": [ + "" + ], + "Anchors": [ + { + "X": 0.5, + "Y": 0.5 + } + ] + } + } + }, + { + "ContentType": "BlogPost", + "ContentItemId": "[js: uuid()]", + "DisplayText": "Man must explore, and this is exploration at its greatest", + "Latest": true, + "Published": true, + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "TitlePart": { + "Title": "Man must explore, and this is exploration at its greatest" + }, + "ContainedPart": { + "ListContentItemId": "[js: variables('blogContentItemId')]", + "Order": 0 + }, + "MarkdownBodyPart": { + "Markdown": "Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory.\n\nScience cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.\n\nWhat was most significant about the lunar voyage was not that man set foot on the Moon but that they set eye on the earth.\n\nA Chinese tale tells of some men sent to harm a young girl who, upon seeing her beauty, become her protectors rather than her violators. That's how I felt seeing the Earth for the first time. I could not help but love and cherish her.\n\nFor those who have seen the Earth from space, and for the hundreds and perhaps thousands more who will, the experience most certainly changes your perspective. The things that we share in our world are far more valuable than those which divide us." + }, + "AutoroutePart": { + "Path": "blog/post-1" + }, + "BlogPost": { + "Subtitle": { + "Text": "Problems look mighty small from 150 miles up" + }, + "Image": { + "Paths": [ + "post-bg.jpg" + ], + "MediaTexts": [ + "" + ], + "Anchors": [ + { + "X": 0.5, + "Y": 0.5 + } + ] + }, + "Tags": { + "TermContentItemIds": [ + "[js: variables('earthTagContentItemId')]", + "[js: variables('explorationTagContentItemId')]", + "[js: variables('spaceTagContentItemId')]" + ], + "TaxonomyContentItemId": "[js: variables('tagsContentItemId')]", + "TagNames": [ + "Earth", + "Exploration", + "Space" + ] + }, + "Category": { + "TermContentItemIds": [ + "[js: variables('categoryTravelContentItemId')]" + ], + "TaxonomyContentItemId": "[js: variables('categoriesContentItemId')]" + } + } + }, + { + "ContentItemId": "[js: uuid()]", + "ContentType": "Article", + "DisplayText": "About", + "Latest": true, + "Published": true, + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "AutoroutePart": { + "Path": "about", + "SetHomepage": false + }, + "HtmlBodyPart": { + "Html": "

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum molestiae debitis nobis, quod sapiente qui voluptatum, placeat magni repudiandae accusantium fugit quas labore non rerum possimus, corrupti enim modi! Et.

" + }, + "TitlePart": { + "Title": "About" + }, + "Article": { + "Subtitle": { + "Text": "This is what I do." + }, + "Image": { + "Paths": [ + "about-bg.jpg" + ] + } + } + }, + { + "ContentItemId": "[js: uuid()]", + "ContentType": "RawHtml", + "Displaytext": "Footer", + "Latest": true, + "Published": true, + "Owner": "[js: parameters('AdminUserId')]", + "Author": "[js: parameters('AdminUsername')]", + "LayerMetadata": { + "Layer": "Always", + "Zone": "Footer", + "RenderTitle": false, + "Position": 10 + }, + "RawHtml": { + "Content": { + "Html": "
This is only a testing footer
" + } + } + } + ] + }, + { + "name": "layers", + "Layers": [ + { + "Name": "Always", + "LayerRule": { + "ConditionId": "[js: uuid()]", + "Conditions": [ + { + "$type": "OrchardCore.Rules.Models.BooleanCondition, OrchardCore.Rules", + "Name": "BooleanCondition", + "Value": true, + "ConditionId": "[js: uuid()]" + } + ] + }, + "Description": "The widgets in this layer are displayed on any page of this site." + }, + { + "Name": "Homepage", + "LayerRule": { + "ConditionId": "[js: uuid()]", + "Conditions": [ + { + "$type": "OrchardCore.Rules.Models.HomepageCondition, OrchardCore.Rules", + "Name": "HomepageCondition", + "Value": true, + "ConditionId": "[js: uuid()]" + } + ] + }, + "Description": "The widgets in this layer are only displayed on the homepage." + } + ] + }, + { + "name": "queries", + "Queries": [ + { + "Source": "Sql", + "Name": "RecentBlogPosts", + "Template": "SELECT * FROM ContentItemIndex WHERE ContentType='BlogPost' ORDER BY CreatedUtc DESC LIMIT 3", + "Schema": "[js:base64('ew0KICAgICJ0eXBlIjogIkNvbnRlbnRJdGVtL0Jsb2dQb3N0Ig0KfQ==')]", + "ReturnContentItems": true + } + ] + }, + { + "name": "AdminMenu", + "data": [ + { + "Id": "baef6f85ad13481681cde70ada401333", + "Name": "Admin menus", + "Enabled": true, + "MenuItems": [ + { + "$type": "OrchardCore.AdminMenu.AdminNodes.LinkAdminNode, OrchardCore.AdminMenu", + "LinkText": "Blog", + "LinkUrl": "[js: variables('adminUrlPrefix') + '/Contents/ContentItems/' + variables('blogContentItemId') + '/Display']", + "IconClass": "fas fa-rss", + "PermissionNames": [], + "UniqueId": "7b293d57056a4eebb3713f07f12c65d8", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": null, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [], + "Classes": [] + }, + { + "$type": "OrchardCore.AdminMenu.AdminNodes.LinkAdminNode, OrchardCore.AdminMenu", + "LinkText": "Main Menu", + "LinkUrl": "[js: variables('adminUrlPrefix') + '/Contents/ContentItems/' + variables('menuContentItemId') + '/Edit']", + "IconClass": "fas fa-sitemap", + "PermissionNames": [], + "UniqueId": "5118cecfde834dacb26ac08980f1b5a7", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": null, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [], + "Classes": [] + }, + { + "$type": "OrchardCore.AdminMenu.AdminNodes.PlaceholderAdminNode, OrchardCore.AdminMenu", + "LinkText": "Content", + "IconClass": null, + "PermissionNames": [], + "UniqueId": "3e590d44f8704e4588e272dd966ce291", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": null, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [ + { + "$type": "OrchardCore.AdminMenu.AdminNodes.LinkAdminNode, OrchardCore.AdminMenu", + "LinkText": "Content Items", + "LinkUrl": "[js: variables('adminUrlPrefix') + '/Contents/ContentItems/']", + "IconClass": null, + "UniqueId": "7b293d57056a4eebb3713f07f12c65d9", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": 0, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [], + "Classes": [] + }, + { + "$type": "OrchardCore.AdminMenu.AdminNodes.PlaceholderAdminNode, OrchardCore.AdminMenu", + "LinkText": "Content Types", + "IconClass": null, + "PermissionNames": [], + "UniqueId": "2f1fc33133334a1abf7d1a0516ee8b4e", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": 1, + "Priority": 50, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [ + { + "$type": "OrchardCore.Contents.AdminNodes.ContentTypesAdminNode, OrchardCore.Contents", + "ShowAll": true, + "IconClass": null, + "ContentTypes": [], + "UniqueId": "ee18224e1b814c638b0732678b74cfd9", + "Enabled": true, + "Text": null, + "Id": null, + "Href": null, + "Url": null, + "Position": null, + "LinkToFirstChild": true, + "LocalNav": false, + "Culture": null, + "Items": [], + "Classes": [] + } + ], + "Classes": [] + } + ], + "Classes": [] + } + ] + } + ] + }, + { + "name": "MediaProfiles", + "MediaProfiles": { + "banner": { + "Hint": "A banner image (2048px x 600px, cropped)", + "Width": 2048, + "Height": 600, + "Mode": 2, + "Format": 0, + "Quality": 100 + } + } + } + ] +} diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/000-saas-setup.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/000-saas-setup.js index 486e9652cee..214c84e6ae4 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/000-saas-setup.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/000-saas-setup.js @@ -5,7 +5,6 @@ const sassSite = { setupRecipe: "SaaS", } - describe('Setup SaaS', function () { it('Successfully setup the SaaS default tenant', function () { cy.visit('/'); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/agency-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/agency-test.js index 00465878803..28cced3084c 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/agency-test.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/agency-test.js @@ -18,8 +18,6 @@ describe('Agency Tests', function () { it('Agency admin login should work', function(){ cy.login(tenant); cy.visit(`${tenant.prefix}/Admin`); - cy.get('.ta-content').should('contain.text', 'Welcome to Orchard') + cy.get('.menu-admin').should('have.id', 'adminMenu') }) - - }); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/blog-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/blog-test.js index 5bd6a140cb6..e8f1be29125 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/blog-test.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/blog-test.js @@ -19,6 +19,6 @@ describe('Blog Tests', function () { it('Blog admin login should work', function(){ cy.login(tenant); cy.visit(`${tenant.prefix}/Admin`); - cy.get('.ta-content').should('contain.text', 'Welcome to Orchard'); + cy.get('.menu-admin').should('have.id', 'adminMenu') }) }); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/comingsoon-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/comingsoon-test.js index affb51c3be0..6c81cd470c8 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/comingsoon-test.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/comingsoon-test.js @@ -18,6 +18,6 @@ describe('ComingSoon Recipe test', function () { it('ComingSoon admin login should work', function(){ cy.login(tenant); cy.visit(`${tenant.prefix}/Admin`); - cy.get('.ta-content').should('contain.text', 'Welcome to Orchard') + cy.get('.menu-admin').should('have.id', 'adminMenu') }) }); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/headless-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/headless-test.js index 1e6d2a75880..af86eada00d 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/headless-test.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/headless-test.js @@ -17,6 +17,6 @@ describe('Headless Recipe test', function () { it('Headless admin login should work', function(){ cy.login(tenant); cy.visit(`${tenant.prefix}/Admin`); - cy.get('.ta-content').should('contain.text', 'Welcome to Orchard') + cy.get('.menu-admin').should('have.id', 'adminMenu') }) }); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/migrations-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/migrations-test.js new file mode 100644 index 00000000000..18a75af5be8 --- /dev/null +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/migrations-test.js @@ -0,0 +1,24 @@ +/// + +import { generateTenantInfo } from 'cypress-orchardcore/dist/utils'; + +describe('Migrations Tests', function () { + let tenant; + + before(() => { + // generate the migrations tenant + tenant = generateTenantInfo("Migrations") + cy.newTenant(tenant); + }) + + it('Displays the home page of the migrations recipe', function () { + cy.visit(`${tenant.prefix}`); + cy.get('.subheading').should('contain.text', 'This is the description of your blog'); + }) + + it('Migrations admin login should work', function () { + cy.login(tenant); + cy.visit(`${tenant.prefix}/Admin`); + cy.get('.menu-admin').should('have.id', 'adminMenu') + }) +}); diff --git a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/sass-test.js b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/sass-test.js index 5d37d404c46..c5c32f5bea8 100644 --- a/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/sass-test.js +++ b/test/OrchardCore.Tests.Functional/cms-tests/cypress/integration/sass-test.js @@ -17,6 +17,6 @@ describe('SaaS Recipe test', function () { it('SaaS admin login should work', function(){ cy.login(tenant); cy.visit(`${tenant.prefix}/Admin`); - cy.get('.ta-content').should('contain.text', 'Welcome to Orchard') + cy.get('.menu-admin').should('have.id', 'adminMenu') }) }); diff --git a/test/OrchardCore.Tests.Functional/cypress-commands/dist/test-runner.js b/test/OrchardCore.Tests.Functional/cypress-commands/dist/test-runner.js index cdd540ca1b5..71eec7b3929 100644 --- a/test/OrchardCore.Tests.Functional/cypress-commands/dist/test-runner.js +++ b/test/OrchardCore.Tests.Functional/cypress-commands/dist/test-runner.js @@ -24,6 +24,14 @@ function deleteDirectory(dir) { global.log(`${dir} deleted`); } +// Copy the migrations recipe +function copyMigrationsRecipeFile(dir) { + if (fs.existsSync('./Recipes/migrations.recipe.json')) { + fs.copyFile('./Recipes/migrations.recipe.json', `${dir}/Recipes/migrations.recipe.json`); + global.log(`migrations recipe copied to ${dir}/Recipes`); + } +} + // Host the dotnet application, does not rebuild function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersion='net7.0' }={}) { if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) { @@ -58,6 +66,7 @@ function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersion='net7 // combines the functions above, useful when triggering tests from CI function e2e(dir, assembly, { dotnetVersion='net7.0' }={}) { + copyMigrationsRecipeFile(dir); deleteDirectory(path.join(dir, "App_Data_Tests")); var server = host(dir, assembly, { appDataLocation: "./App_Data_Tests", dotnetVersion }); diff --git a/test/OrchardCore.Tests/OrchardCore.Tests.csproj b/test/OrchardCore.Tests/OrchardCore.Tests.csproj index 1fb053a61fd..aaaf2f9d06f 100644 --- a/test/OrchardCore.Tests/OrchardCore.Tests.csproj +++ b/test/OrchardCore.Tests/OrchardCore.Tests.csproj @@ -33,16 +33,16 @@ + - - - + +