MemberService.GetAll: Invalid column name 'createDate'.
a
Upgrading a project to the newest v8 in preparation for the upgrade to v10 and v13 but getting a weird issue after going from 8.13.0 to 8.18.12 when using the GetAll method on the MemberService
memberService.GetAll(page - 1, 20, out _, sortColumn, sortDirection, "Member", "")
Anyone else encounter an issue like this?
Copy code
Invalid column name 'createDate'.
Statement(s) could not be prepared.
a
Yeah, it's weird. It works in other projects, too. And it looks very similar to what you've got there.
It works unchanged in the test branch
s
Sidenote: you absolutely will run into performance problems if you use the memberservice, it goes straight to the database. The recommendation is to do querying of data through examine.
That said, it looks like your database is missing a property with the alias
createDate
- but that's as much as I can tell from the error at the moment 🙈
a
Yeah. I haven't really figured out how to query members. The documentation in that space is a bit sparse. It's always querying content.
The function we're using here I found by searching Umbraco's source code and figuring out what the Members section is doing
Also, this is just being used in a custom backoffice section so it's not being used super heavily
s
This is a start:
Copy code
csharp
    var members = new List<IPublishedContent>();
    if (ExamineManager.Instance.TryGetIndex("MembersIndex", out var index))
    {
        var searcher = index.GetSearcher();
        var results = searcher.CreateQuery(IndexTypes.Member).All().Execute();
        members.AddRange(results.Select(result => Umbraco.Member(result.Id)));
    }
a
Ah, thanks!
s
Anyway, your code should work, so I'm afraid there's something not quite right on the
Members
datatype, but .. I'm not sure what!
The error you get
Statement(s) could not be prepared.
is a SQL server error, not coming from Umbraco, so there's something about the generated query that doesn't work.
a
Yeah, that's what I got from it as well
Not sure what's going on. The Members section still works fine. It shows the Date Created and everything
And, like I said, the upgrade worked fine on the test branch. So I wonder if something just went crazy on the upgrade. I used a local database copy for testing purposes. Thought I would retry the upgrade and see if it was just a fluke
s
Just use the upgraded database copy then 😅 😂
I bet the other database didn't get upgraded, might want to set version
8.13.0
in
"Umbraco.Core.ConfigurationStatus"
in the web.config to force the upgrade installer to run.
a
well, that change fixed the problem, so we might just run with it 😂
s
Excellent! Yeah you accidentally ran v 8.18 against a 8.13 database so this fixes the problem by running the migrations to an 8.18 db. Buy me a beer when you meet me 😜
29 Views