mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 修复 CodeFirst IsNullable 迁移脚本重复 NOT NULL 语法错误;
This commit is contained in:
parent
d4e73641a4
commit
dbc323a22c
@ -21,6 +21,9 @@ namespace FreeSql.Tests.MySqlConnector
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.Odbc.Dameng
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.Odbc.MySql
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.Odbc.Oracle
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -25,6 +25,9 @@ namespace FreeSql.Tests.Odbc.PostgreSQL
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -23,6 +23,9 @@ namespace FreeSql.Tests.Odbc.SqlServer
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.MsAccess
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.MySql
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.Oracle
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -28,6 +28,9 @@ namespace FreeSql.Tests.PostgreSQL
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -22,6 +22,9 @@ namespace FreeSql.Tests.SqlServer
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -21,6 +21,9 @@ namespace FreeSql.Tests.Sqlite
|
||||
public Guid Id { get; set; }
|
||||
[Column(StringLength = 50)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Column(IsNullable = false, StringLength = 50)]
|
||||
public string TitleSub { get; set; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -124,7 +124,7 @@ namespace FreeSql.Internal
|
||||
if ((colattr.IsNullable != true || colattr.IsIdentity == true || colattr.IsPrimary == true) && colattr.DbType.Contains("NOT NULL") == false)
|
||||
{
|
||||
colattr.IsNullable = false;
|
||||
colattr.DbType += " NOT NULL";
|
||||
colattr.DbType = Regex.Replace(colattr.DbType, @"\bNULL\b", "").Trim() + " NOT NULL";
|
||||
}
|
||||
if (colattr.IsNullable == true && colattr.DbType.Contains("NOT NULL")) colattr.DbType = colattr.DbType.Replace("NOT NULL", "");
|
||||
colattr.DbType = Regex.Replace(colattr.DbType, @"\([^\)]+\)", m =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user