https://metaplay.io logo
Table 'AuditLogEvents' already exists when migrati...
# questions-and-feedback
d
Hi, After migrating to SDK v35.2 and either deploying or starting a local server, I get this error: Unhandled exception. MySqlConnector.MySqlException (0x80004005): Table 'AuditLogEvents' already exists I'll post the full log in a comment. I've followed every step of the migration process and it is revertable, but I'd like to solve this.
j
Heya, Based on your logs, it appears that there are 2 active "create" migrations for the database. One hypothesis on how this might happen is if you run
metaplay init sdk/project
a second time after the project has already been initialized. If you happen to have any insights, please do share! To fix this: 1. Revert
Backend/Server/Migrations
to the state before the R35 update 2. Run
dotnet ef migrations add MetaplayRelease35
as per the [version update guide](https://docs.metaplay.io/miscellaneous/sdk-updates/release-notes/release-35.html#for-all-metaplay-projects) 3. Redeploy your server Hope this helps, let us know if you run into any further issues!
d
Thanks for the answer. I had 2 sets of files (
xxx_InitialCreate.cs
and
xxx_InitialCreate.Designer.cs
) after the migration, one from the previous version, one from the update. After running the schema migration command,
xxx_MetaplayRelease35.cs
and
xxx_MetaplayRelease35.Designer.cs
were added and versioned. When building the server image, I had a duplicate definition exception from the InitialCreate files, so I deleted the first set of files from the previous version, fixing the issue. Then I had the issue we're discussing when trying to deploy. Should I keep the 'InitialCreate' set of files from the SDK migration? Also, I'm no longer able to build the image after moving the diffs to a branch. It seems some files now have crlf line endings and the pnpm install command no longer works. I've joined the error log. edit: seems solved by simply bruteforcing every line ending from crlf to lf in Backend/ and MetaplaySDK/ folders https://cdn.discordapp.com/attachments/1458419076262137960/1458460443772321815/log_crlf.txt?ex=695fb8a2&is=695e6722&hm=3069a1727f0c698a356722a7665eebe385ef232c7ef519d5b541bfbd273009ca&
I did what seemed to be logical to me, I reinstated the first set of InitialCreate files from the initial install, removed the ones from the update and rerun the
dotnet ef migrations add MetaplayRelease35
command. I now get a new error when starting a local server:
Metaplay.Core.IO.IODecodingError: Byte array larger than remaining input: length=6673241, remaining=6673131)
Note that I've deleted the local Database before starting the server. I've joined the logs I'm completely out of ideas :<
a
This issue looks unrelated to the gameserver database migrations, it appears that a cached geolocation file is somehow corrupted. Can you try to remove all files under the path
Backend/Server/bin/PrivateBlobStorage/Geolocation
and try starting the server again? Rather than just deleting, you could rename that folder to, say,
Geolocation_corrupt
so that we can inspect the nature of the corruption later..
d
@Antti // Metaplay Indeed, I'm now able to start a local server. I've joined the supposedly corrupted files. However, when creating a new account (I've again flushed the local server DB & local player data):
Failed to register account, Player:MSO8L3Owfe already exists: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'table Players has no column named LifecycleStatus'.
I'm still confused regarding what DB InitialCreate/migration files I should use/keep/discard. I think this is what is causing the latest issue. I'll fiddle with those as much as I can, I've zipped and joined what I'm using right now (so InitialCreate from R34 + MetaplayRelease35). https://cdn.discordapp.com/attachments/1458419076262137960/1458752618552754242/Geolocation_corrupted.zip?ex=6960c8be&is=695f773e&hm=a9d6f93c6a839f174590e38c4a36476e5d82a0a74f1609cb8455ee8434dde12c& https://cdn.discordapp.com/attachments/1458419076262137960/1458752619051745471/log_new_player.txt?ex=6960c8be&is=695f773e&hm=ea20be873eb18119f1adf910761728ce0084db3b682f9f75071883496160e96e& https://cdn.discordapp.com/attachments/1458419076262137960/1458752619425169409/Migrations.zip?ex=6960c8be&is=695f773e&hm=63e1643f4e0adc22d96c8f0426cdba6eaa58448b390d2529a7cf62a15d5c5e82&
a
The problem now appears to be that the "MetaplayRelease35" database schema migration is empty. For some reason your run of
dotnet ef migrations add
has not produced the expected outcome -- could it be that you ran it before the SDK code was updated?
d
@Antti // Metaplay I did not run the command before the update no. That said, I removed the
InitialRelease
files and rerun the command, having only MetaplayRelease35.cs files + GameDbContextModelSnapshot.cs in the Migration folder, and now the local server works
I did not find anything related to the matter in the documentation, I don't know if what I'm doing is right
I was able to deploy in env Dev and the save from r34 is still working :> still, I'd like to know more about what went wrong
4 Views