Dot Net Dev
Dot Net Dev

Reputation: 614

Cannot alter a table with primary key using Fluent Migrator

I am trying to use Fluent Migrator to alter a table to add a column which is a Guid, not nullable and primary key.

Example: test_user (table)

+++++++++

col1 col2

+++++++++

test1 test2

test3 test4

+++++++++

I am using the below syntax to add a column to an existing table:

    Alter.Table("test_user").AddColumn("test_user_id").AsGuid().NotNullable().WithDefault(SystemMethods.NewGuid);

    Create.PrimaryKey("pk_test_user")
        .OnTable("test_user").Column("test_user_id");

If the table has data like in the example it should add unique Guid's

error: "check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT UUID())'"

Upvotes: 0

Views: 759

Answers (1)

Martin D.
Martin D.

Reputation: 2090

You must have version 8.0.13 or higher of MySQL to use default values.

Upvotes: 0

Related Questions