Aiyuni
Aiyuni

Reputation: 810

How to auto-generate unique_rowId with Fluent Migrator in CockroachDB?

I'm using Fluent Migrator in NET 6.

I'm trying to set an unique_rowId to an int64 column. On cockroach DB, I would use

Create table x (version INT NOT NULL DEFAULT unique_rowid())

With fluent migrator, I cannot find a method to do the above.

I have tried this: Create.Table("x").WithColumn("version").AsInt165().NotNullable().WithDefaultValue(SystemMethods.NewGuid)

but this fails because SystemMethods.NewGuid (and related, SystemMethods.NewSequentialId) both returns a GUID, and the column is an int type.

Is it possible to do this with fluent migrator?

Upvotes: 0

Views: 200

Answers (1)

Aiyuni
Aiyuni

Reputation: 810

I believe we can use Create.Table("x").WithColumn("version").Identity() to generate unique_rowid of type int.

Upvotes: 0

Related Questions