Changing from sqlserver to mysql using efcore

0

i was previously using MSSQLSERVER in my project, then i switched to a mysql database using ef core by installing the pomelo mysql client and using that in my configure services. when i try to update the new mysql database using the previous migrations i had gotten from mssql i am getting a bunch of errors the most annoying error was:

 Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      CREATE TABLE `Activities` (
          `Id` uniqueidentifier(36) NOT NULL,
          `Title` nvarchar(max) NULL,
          `Description` nvarchar(max) NULL,
          `Category` nvarchar(max) NULL,
          `Date` datetime2(6) NOT NULL,
          `City` nvarchar(max) NULL,
          `Venue` nvarchar(max) NULL,
          CONSTRAINT `PK_Activities` PRIMARY KEY (`Id`)
      );
fail: API.Program[0]
      An error occured during migration
MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corre
sponds to your MySQL server version for the right syntax to use near 'uniqueidentifier(36) NOT NULL,
    `Title` nvarchar(max) NULL,
    `Descriptio' at line 2

the migration file that the error is pointing to:

namespace Persistence.Migrations
{
    public partial class ActivityEntityAdded : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Activities",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Title = table.Column<string>(nullable: true),
                    Description = table.Column<string>(nullable: true),
                    Category = table.Column<string>(nullable: true),
                    Date = table.Column<DateTime>(nullable: false),
                    City = table.Column<string>(nullable: true),
                    Venue = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Activities", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Activities");
        }
    }
}

can someone please tell me how to fix this error? or does mysql not support guids as of yet? Please any input will be much appreciated!

c#
mysql
asp.net-core
.net-core
entity-framework-core
asked on Stack Overflow Nov 24, 2020 by DBankx

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0