码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-05-01 01:14:55      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:arch   bsp   als   offset   tab   允许   string   ble   改变   

 

允许为空

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 迁移时将字段由不允许为空改变为允许为空、修改字段长度限制

标签:arch   bsp   als   offset   tab   允许   string   ble   改变   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!