OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.44k stars 2.4k forks source link

Query Field Blank After Upgrading Orchard from Version 1.8.3 to 2.0.0 #16783

Closed vikasmahant69 closed 1 week ago

vikasmahant69 commented 1 month ago

Describe the bug

After upgrading Orchard CMS from version 1.8.3 to 2.0.0, the query field appears blank for all existing queries. This issue affects queries created using Elastic, Lucene, or SQL in the admin section, as they are no longer visible in the query field post-upgrade.

Newly created queries function correctly, but if you create a deployment plan from these new queries and import it into the same version, the query field still appears blank

Orchard Core version

2.0.0

To Reproduce

Create a query (e.g., Elastic, Lucene, or SQL) in Orchard version 1.8.3 from the admin section. Upgrade the source code to Orchard version 2.0.0. Navigate to the admin section and open the same query created in version 1.8.3. Observe that the query field is blank or empty.

Expected behavior

All existing queries created in version 1.8.3 should be visible and editable in the admin section after upgrading to version 2.0.0.

Logs and screenshots

error screenshot OCQueryError

github-actions[bot] commented 1 month ago

Thank you for submitting your first issue, awesome! 🚀 We're thrilled to receive your input. If you haven't completed the template yet, please take a moment to do so. This ensures that we fully understand your feature request or bug report. On what happens next, see the docs.

If you like Orchard Core, please star our repo and join our community channels.

Piedone commented 1 month ago

Do you have anything in the logs? @MikeAlhayek could you please chime in?

MikeAlhayek commented 1 month ago

@vikasmahant69 can you please check the data migration records to see if the following migrations ran?

For SQL queries https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Queries/Sql/Migrations/SqlQueryMigrations.cs

For Elasticsearch queries https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Migrations/ElasticsearchQueryMigrations.cs

For Lucene queries https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Migrations/LuceneQueryMigrations.cs

If not, please check your log files for errors.

Which database type are you using?

it is possible that this like throw an exception during migration https://github.com/OrchardCMS/OrchardCore/blob/80ff8b867a286544ab135c0a1301034bf5146303/src/OrchardCore/OrchardCore.Queries.Core/QueriesDocumentMigrationHelper.cs#L56

vikasmahant69 commented 1 month ago

@MikeAlhayek I checked the data migration records and see the following migrations ran

{"Id":21,"DataMigrations":[{"DataMigrationClass":"OrchardCore.Liquid.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.ContentManagement.Records.Migrations","Version":6},{"DataMigrationClass":"OrchardCore.Contents.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Title.Migrations","Version":2},{"DataMigrationClass":"OrchardCore.Html.Migrations","Version":5},{"DataMigrationClass":"OrchardCore.Alias.Migrations","Version":4},{"DataMigrationClass":"OrchardCore.Autoroute.Migrations","Version":5},{"DataMigrationClass":"OrchardCore.ContentFields.Migrations","Version":2},{"DataMigrationClass":"OrchardCore.Users.Migrations","Version":13},{"DataMigrationClass":"OrchardCore.ContentPreview.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Deployment.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Widgets.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Flows.Migrations","Version":3},{"DataMigrationClass":"OrchardCore.Forms.Migrations","Version":4},{"DataMigrationClass":"OrchardCore.Media.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.ReCaptcha.Forms.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Workflows.Migrations","Version":3},{"DataMigrationClass":"OrchardCore.Contents.AuditTrail.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.AdminDashboard.Migrations","Version":3},{"DataMigrationClass":"OrchardCore.AuditTrail.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.ContentFields.Indexing.SQL.Migrations","Version":5},{"DataMigrationClass":"OrchardCore.ContentFields.Indexing.SQL.UserPickerMigrations","Version":2},{"DataMigrationClass":"OrchardCore.Sitemaps.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Contents.Deployment.ExportContentToDeploymentTarget.ExportContentToDeploymentTargetMigrations","Version":1},{"DataMigrationClass":"OrchardCore.Indexing.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Layers.Migrations","Version":3},{"DataMigrationClass":"OrchardCore.Lists.Migrations","Version":4},{"DataMigrationClass":"OrchardCore.Markdown.Migrations","Version":4},{"DataMigrationClass":"OrchardCore.Menu.Migrations","Version":4},{"DataMigrationClass":"OrchardCore.PublishLater.Migrations","Version":3},{"DataMigrationClass":"OrchardCore.Search.Migrations.SearchMigrations","Version":1},{"DataMigrationClass":"OrchardCore.Search.Lucene.Migrations","Version":1},{"DataMigrationClass":"OrchardCore.Seo.Migrations","Version":2},{"DataMigrationClass":"OrchardCore.Taxonomies.Migrations","Version":5},{"DataMigrationClass":"OrchardCore.Email.Migrations.EmailMigrations","Version":1},{"DataMigrationClass":"OrchardCore.Queries.Sql.Migrations.SqlQueryMigrations","Version":1},{"DataMigrationClass":"OrchardCore.Queries.Sql.Migrations.ElasticsearchQueryMigrations","Version":1},{"DataMigrationClass":"OrchardCore.Queries.Sql.Migrations.LuceneQueryMigrations","Version":1}]}}

I'm using MSSQL 2022

MikeAlhayek commented 1 month ago

It looks like the migrations ran. Any errors in the logs?

vikasmahant69 commented 1 month ago

No errors, queries simply disappear when opened from the query section from the admin

vikasmahant69 commented 1 month ago

I also encountered a new issue in Graphql " "message": "Error trying to resolve field 'termContentItems'."," it was working working with 1.8.3

here is my query

query MyQuery { charities { contentItemId name sector { termContentItems { display text } } } }

davidpuplava commented 1 month ago

Hi @vikasmahant69 - I tried to reproduce this error but haven't been able to do it yet. Here are the steps i used:

  1. Check out v1.8.3 of the source code
  2. Renamed existing App_Data folder (to ensure new v1.8.3 database is created)
  3. Initialized the site using the Blog Recipe
  4. Navigated to Admin section
  5. Went to Search section, selected All Queries
  6. Added a new SQL Query (just copied/pasted from existing content query)
  7. Git check out v2.0.0 tag
  8. Rebuild, and run
  9. Navigated to the Admin->Search->All Queries->TestQuery
  10. Observe the query is still there

Did I miss a step in trying to reproduce this?

PBMikeW commented 1 month ago

This has occurred for both my sites with all the elastic queries, Lucene and SQL were fine, was able to reinsert them from backups but definitely an issue.

vikasmahant69 commented 1 month ago

@MikeAlhayek I have attached scenarios in videos for both 1.8.3 and then upgraded to 2.0.2

Version 1.8.3

https://github.com/user-attachments/assets/a1b087e8-52a5-447c-9725-2680082c1e2e

Version 2.0.2

https://github.com/user-attachments/assets/5197feb7-1ea7-4a87-bae0-39da7bcbe633

MikeAlhayek commented 1 month ago

@vikasmahant69

I just tried creating a blog recipe using 1.8. Migrated it to main, no issues with the lost properties.

The second error is related to GraphQL which may need to be tracked separately. Please open another issues. For my none of my queries are listed on the GraphiQL explorer.

vikasmahant69 commented 1 month ago

done https://github.com/OrchardCMS/OrchardCore/issues/16883

github-actions[bot] commented 2 weeks ago

It seems that this issue didn't really move for quite a while despite us asking the author for further feedback. Is this something you'd like to revisit any time soon or should we close? Please reply.

github-actions[bot] commented 1 week ago

Closing this issue because it didn't receive further feedback from the author for very long. If you think this is still relevant, feel free to reopen it with the requested details.