Skip to content

Commit bc66f4c

Browse files
committed
Updated MySql, Oracle and PostgreSql drivers to versions currently used in projects.
Implemented fix to dialect to allow specifying which types can support being "unsigned" which fixes issues with Migrator.Net trying to create "unsigned" primary keys when their type is "Guid", "varchar(n)" etc.
1 parent 9bb595b commit bc66f4c

File tree

12 files changed

+35
-5750
lines changed

12 files changed

+35
-5750
lines changed

lib/MySql.Data.dll

96 KB
Binary file not shown.
11.5 KB
Binary file not shown.

lib/Npgsql/net-2.0/Npgsql.dll

57.5 KB
Binary file not shown.

lib/Npgsql/net-2.0/Npgsql.xml

Lines changed: 0 additions & 2874 deletions
This file was deleted.
11.5 KB
Binary file not shown.

lib/Npgsql/net-3.5/Npgsql.dll

57.5 KB
Binary file not shown.

lib/Npgsql/net-3.5/Npgsql.xml

Lines changed: 0 additions & 2874 deletions
This file was deleted.

lib/Oracle.DataAccess.dll

16 KB
Binary file not shown.

src/Migrator.Providers/ColumnPropertiesMapper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ public void MapColumnProperties(Column column)
8787
if (! dialect.IdentityNeedsType)
8888
AddValueIfSelected(column, ColumnProperty.Identity, vals);
8989

90-
AddValueIfSelected(column, ColumnProperty.Unsigned, vals);
90+
if (dialect.IsUnsignedCompatible(column.Type))
91+
AddValueIfSelected(column, ColumnProperty.Unsigned, vals);
92+
9193
if (! PropertySelected(column.ColumnProperty, ColumnProperty.PrimaryKey) || dialect.NeedsNotNullForIdentity)
9294
AddValueIfSelected(column, ColumnProperty.NotNull, vals);
9395

src/Migrator.Providers/Dialect.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public abstract class Dialect
1313
readonly Dictionary<ColumnProperty, string> propertyMap = new Dictionary<ColumnProperty, string>();
1414
readonly HashSet<string> reservedWords = new HashSet<string>();
1515
readonly TypeNames typeNames = new TypeNames();
16+
readonly List<DbType> unsignedCompatibleTypes = new List<DbType>();
1617

1718
protected Dialect()
1819
{
@@ -204,5 +205,25 @@ public ColumnPropertiesMapper GetAndMapColumnProperties(Column column)
204205
mapper.Default = column.DefaultValue;
205206
return mapper;
206207
}
208+
209+
/// <summary>
210+
/// Subclasses register which DbTypes are unsigned-compatible (ie, available in signed and unsigned variants)
211+
/// </summary>
212+
/// <param name="type"></param>
213+
protected void RegisterUnsignedCompatible(DbType type)
214+
{
215+
unsignedCompatibleTypes.Add(type);
216+
}
217+
218+
/// <summary>
219+
/// Determine if a particular database type has an unsigned variant
220+
/// </summary>
221+
/// <param name="type">The DbType</param>
222+
/// <returns>True if the database type has an unsigned variant, otherwise false</returns>
223+
public bool IsUnsignedCompatible(DbType type)
224+
{
225+
return unsignedCompatibleTypes.Contains(type);
226+
}
227+
207228
}
208229
}

0 commit comments

Comments
 (0)