[dev utility] fxmigrant, automated database migrations for mysql

A basic migration resource based on FluentMigrator.

image to 'hide' for releases section backdrop

image

See the repository README for more instructions.

10 Likes

what is this?

automated database migrations for mysql
A basic migration resource based on FluentMigrator.

Please read before asking questions.

I don’t understand what is :smiley:
more detailed if possible?

If you don’t understand then you don’t need to worry nor use it. Simple.

Migrating from what exactly?

How to use this shit? How to create tables by that?

Really useful thanks.

So when I build this on a Windows machine and upload it to a Linux server there are errors about missing methods in the files that are produced. The FiveM console is showing errors pointing to a file located at C:\Users\fluid\blah\blah… which obviously is not the same directory structure as is running on the Linux server.

We basically end here:

at FxMigrant.Main.LoadMigrationAssembly (System.String resourceName, System.String fileName) [0x001c1] in C:\Users\fluid\Downloads\fxmigrant\server\Main.cs:202

Also getting the same error with your builds both versions 0.1.1 and build 0.1.

FIXED in server artifact version >=1510

I’m getting the same error, but I’m on Windows. The directory mismatch is actually not important as that is just information coming from the .pdb, if I’m not mistaken.

Trying to migrate esplugin_mysql migrations. Made sure that mysql_connection_string is correct.

ensure mysql-async
ensure essentialmode
ensure esplugin_mysql

Artifact: 1506
OS: Windows
dotnet: 2.2.401

What I’ve tried: Updated CitizenFX.Core.Server.dll. Updated other deps (but downgraded again).
Repro Resource: testresource.zip (776 Bytes)

UPDATE: Currently using different server artifacts. v1266 (around the time of fxmigrant release) works. Currently trying to find when it doesn’t.
UPDATE #2: v1390 Works | v1392 doesn’t. v1392 is when enhanced stack trace support was introduced

Impacting Commits: https://github.com/citizenfx/fivem/commit/98d728177743a07a2469770b2f7203abb9d71930
https://github.com/citizenfx/fivem/commit/3779e54d3ab6e2d8231b1af8a99aa393ac5a855d

Full error is:

Failed to run a tick for Main: System.MissingMethodException: Method not found: void System.Reflection.PortableExecutable.DebugDirectoryBuilder.AddPdbChecksumEntry(string,System.Collections.Immutable.ImmutableArray`1<byte>)
  at Microsoft.CodeAnalysis.Compilation.SerializePeToStream (Microsoft.CodeAnalysis.Emit.CommonPEModuleBuilder moduleBeingBuilt, Microsoft.CodeAnalysis.DiagnosticBag metadataDiagnostics, Microsoft.CodeAnalysis.CommonMessageProvider messageProvider, System.Func`1[TResult] getPeStream, System.Func`1[TResult] getMetadataPeStreamOpt, System.Func`1[TResult] getPortablePdbStreamOpt, Microsoft.Cci.PdbWriter nativePdbWriterOpt, System.String pdbPathOpt, System.Boolean metadataOnly, System.Boolean includePrivateMembers, System.Boolean isDeterministic, System.Boolean emitTestCoverageData, System.Nullable`1[T] privateKeyOpt, System.Threading.CancellationToken cancellationToken) [0x0002b] in <d0642716c3b146be9b65b203382ff378>:0
  at Microsoft.CodeAnalysis.Compilation.SerializeToPeStream (Microsoft.CodeAnalysis.Emit.CommonPEModuleBuilder moduleBeingBuilt, Microsoft.CodeAnalysis.Compilation+EmitStreamProvider peStreamProvider, Microsoft.CodeAnalysis.Compilation+EmitStreamProvider metadataPEStreamProvider, Microsoft.CodeAnalysis.Compilation+EmitStreamProvider pdbStreamProvider, System.Func`2[T,TResult] testSymWriterFactory, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, System.Boolean metadataOnly, System.Boolean includePrivateMembers, System.Boolean emitTestCoverageData, System.String pePdbFilePath, System.Nullable`1[T] privateKeyOpt, System.Threading.CancellationToken cancellationToken) [0x00150] in <d0642716c3b146be9b65b203382ff378>:0
  at Microsoft.CodeAnalysis.Compilation.Emit (System.IO.Stream peStream, System.IO.Stream metadataPEStream, System.IO.Stream pdbStream, System.IO.Stream xmlDocumentationStream, System.IO.Stream win32Resources, System.Collections.Generic.IEnumerable`1[T] manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions options, Microsoft.CodeAnalysis.IMethodSymbol debugEntryPoint, System.IO.Stream sourceLinkStream, System.Collections.Generic.IEnumerable`1[T] embeddedTexts, Microsoft.CodeAnalysis.CodeGen.CompilationTestData testData, System.Threading.CancellationToken cancellationToken) [0x00122] in <d0642716c3b146be9b65b203382ff378>:0
  at Microsoft.CodeAnalysis.Compilation.Emit (System.IO.Stream peStream, System.IO.Stream pdbStream, System.IO.Stream xmlDocumentationStream, System.IO.Stream win32Resources, System.Collections.Generic.IEnumerable`1[T] manifestResources, Microsoft.CodeAnalysis.Emit.EmitOptions options, Microsoft.CodeAnalysis.IMethodSymbol debugEntryPoint, System.IO.Stream sourceLinkStream, System.Collections.Generic.IEnumerable`1[T] embeddedTexts, System.IO.Stream metadataPEStream, System.Threading.CancellationToken cancellationToken) [0x001bc] in <d0642716c3b146be9b65b203382ff378>:0
  at FxMigrant.Main+<>c__DisplayClass6_0.<LoadMigrationAssembly>b__0 () [0x00144] in C:\Users\rt\Documents\Projects\fxmigrant\server\Main.cs:185
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <fbc4ec45371543bfba3678ebb82caf6d>:0
  at System.Threading.Tasks.Task.Execute () [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
--- End of stack trace from previous location where exception was thrown ---

  at FxMigrant.Main.LoadMigrationAssembly (System.String resourceName, System.String fileName) [0x001b9] in C:\Users\rt\Documents\Projects\fxmigrant\server\Main.cs:204
  at FxMigrant.Main.MigrateResource (System.String resourceName) [0x0013b] in C:\Users\rt\Documents\Projects\fxmigrant\server\Main.cs:77
  at FxMigrant.Main.RunTick () [0x00096] in C:\Users\rt\Documents\Projects\fxmigrant\server\Main.cs:59

From initial Google results it looks like something with incompatible Microsoft.CodeAnalysis packages. Haven’t found out which one it is

Upgrading to Microsoft.CodeAnalysis.CSharp.Workspaces v3.2.1 did not help nor did downgrading to v3.0.0

1 Like

Seemingly this 2019-03-dated version of System.Reflection.Metadata from Mono was actually from 2016, and for other reasons MONO_PATH is searched before a local assembly directory.

1 Like

Issue above fixed in server artifact 1510. Thanks!

1 Like

Now I just need a Linux version for 1510 :smiley: