mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 修复 pgsql varchar(120) CodeFirst 迁移不修改长度;
This commit is contained in:
		@@ -290,7 +290,16 @@ where ns.nspname = {0} and c.relname = {1}", tboldname ?? tbname);
 | 
			
		||||
                            string.IsNullOrEmpty(tbcol.Attribute.OldName) == false && tbstruct.TryGetValue(tbcol.Attribute.OldName, out tbstructcol))
 | 
			
		||||
                        {
 | 
			
		||||
                            var isCommentChanged = tbstructcol.comment != (tbcol.Comment ?? "");
 | 
			
		||||
                            if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false ||
 | 
			
		||||
                            var sqlTypeSize = tbstructcol.sqlType;
 | 
			
		||||
                            if (sqlTypeSize.Contains("(") == false)
 | 
			
		||||
                            {
 | 
			
		||||
                                switch (sqlTypeSize.ToLower())
 | 
			
		||||
                                {
 | 
			
		||||
                                    case "bit": case "varbit": case "bpchar": case "varchar":
 | 
			
		||||
                                        sqlTypeSize = $"{sqlTypeSize}({tbstructcol.max_length})"; break;
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            if (tbcol.Attribute.DbType.StartsWith(sqlTypeSize, StringComparison.CurrentCultureIgnoreCase) == false ||
 | 
			
		||||
                                tbcol.Attribute.DbType.Contains("[]") != (tbstructcol.attndims > 0))
 | 
			
		||||
                                sbalter.Append("ALTER TABLE ").Append(_commonUtils.QuoteSqlName($"{tbname[0]}.{tbname[1]}")).Append(" ALTER COLUMN ").Append(_commonUtils.QuoteSqlName(tbstructcol.column)).Append(" TYPE ").Append(tbcol.Attribute.DbType.Split(' ').First()).Append(";\r\n");
 | 
			
		||||
                            if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user