Open Closed

MySQL Guid Generation #6165


User avatar
0
shorhabelsc created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.3.1
  • UI Type: Angular
  • Database System: EF Core SQL Server migrating to MySQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi,

We have been using ABP Framework for a while with MS SQL Server, therefore we are using the SequentialGuidType.SequentialAtEnd Guid Generator type; however we are migrating to MySql where you are recommending to use SequentialGuidType.SequentialAsString; therefore I have a couple of questions here:

  • I presume that you recommendation to use SequentialGuidType.SequentialAsString assumes that Guids will be stored as char(36) in the mysql db. However, I would like to store Guids as binary(16) as it is more efficient across the board, so I assume it does make more sense in this case to use SequentialGuidType.SequentialAsBinary. I appreciate your thoughts on this
  • Assuming my proposal above is valid, then as part of our data migration from SQL Server to MySql we will have to convert all guids in our database from SequentialGuidType.SequentialAsString to SequentialGuidType.SequentialAtEnd by flipping the order of the first 6-bytes and the last 10-bytes

Looking forward for your feedback

regards, SG


4 Answer(s)
  • User Avatar
    -1
    maliming created
    Support Team Fullstack Developer

    hi

    You can change the GUID way based on your actually case.

    There are no restrictions.

  • User Avatar
    0
    shorhabelsc created

    Thanks for the feedback. yet I would like to confirm that the Sequential As String was used because the Guid was stored as char, and so if we decide to use binary format then it won't work well in this case?

  • User Avatar
    -1
    maliming created
    Support Team Fullstack Developer

    hi

    I think EF Core can handle the conversion between the database and your model.

    https://learn.microsoft.com/en-us/ef/core/modeling/value-conversions?tabs=data-annotations

  • User Avatar
    0
    shorhabelsc created

    hi

    You can change the GUID way based on your actually case.

    There are no restrictions.

    You are not answering my question at all. Thanks anyhow

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11