]> git.smokeofanarchy.ru Git - space-station-14.git/commit
Fix admin notes and database time nonsense. (#25280)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Tue, 20 Feb 2024 09:13:31 +0000 (10:13 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Feb 2024 09:13:31 +0000 (10:13 +0100)
commit2e6eaa45c57c7f5ba561d1fb1ef6712d2432a8fa
treef39a050c7f0875f520883885579b79c1cfef0c57
parent2907e84b6f43f2b3a161a40daaa84fd27e0c83cd
Fix admin notes and database time nonsense. (#25280)

God bloody christ. There's like three layers of shit here.

So firstly, apparently we were still using Npgsql.EnableLegacyTimestampBehavior. This means that time values (which are stored UTC in the database) were converted to local time when read out. This meant they were passed around as kind Local to clients (instead of UTC in the case of SQLite). That's easy enough to fix just turn off the flag and fix the couple spots we're passing a local DateTime ez.

Oh but it turns out there's a DIFFERENT problem with SQLite: See SQLite we definitely store the DateTimes as UTC, but when Microsoft.Data.Sqlite reads them it reads them as Kind Unspecified instead of Utc.

Why are these so bad? Because the admin notes system passes DateTime instances from EF Core straight to the rest of the game code. And that means it's a PAIN IN THE ASS to run the necessary conversions to fix the DateTime instances. GOD DAMNIT now I have to make a whole new set of "Record" entities so we avoid leaking the EF Core model entities. WAAAAAAA.

Fixes #19897
19 files changed:
Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs
Content.Client/Administration/UI/Notes/AdminNotesLinePopup.xaml.cs
Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Content.Server.Database/Model.cs
Content.Server.Database/ModelPostgres.cs
Content.Server/Administration/Notes/AdminMessageEui.cs
Content.Server/Administration/Notes/AdminNotesExtensions.cs
Content.Server/Administration/Notes/AdminNotesManager.cs
Content.Server/Administration/Notes/IAdminNotesManager.cs
Content.Server/Database/DatabaseRecords.cs [new file with mode: 0644]
Content.Server/Database/PlayerRecord.cs [deleted file]
Content.Server/Database/ServerBanNote.cs [deleted file]
Content.Server/Database/ServerDbBase.cs
Content.Server/Database/ServerDbManager.cs
Content.Server/Database/ServerDbPostgres.cs
Content.Server/Database/ServerDbSqlite.cs
Content.Server/Database/ServerRoleBanNote.cs [deleted file]
Content.Shared/Administration/Notes/SharedAdminNote.cs
Content.Shared/CCVar/CCVars.cs