首页 > 其他 > 详细

EF Core 迁移时将字段由不允许为空改变为允许为空、修改字段长度限制

时间:2020-05-01 01:17:52      阅读:196      评论:0      收藏:0      [点我收藏+]

 

允许为空

migrationBuilder.AlterColumn<string>(
name: "BirthData",
table: "Demo_Author",
type: "datetimeoffset(7)",
nullable: true,
oldNullable:false);

 

修改字段长度限制

migrationBuilder.AlterColumn<string>(
name: "Email",
table: "Demo_Author",
maxLength: 30,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);

migrationBuilder.AlterColumn<string>(
name: "Email",
table: "App_User",
maxLength: 40,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);

EF Core 迁移时将字段由不允许为空改变为允许为空、修改字段长度限制

原文:https://www.cnblogs.com/Anthony518/p/12812159.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!