示例#1
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckPrimaryKey(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (old.IsPrimaryKey && [email protected])
     {
         metaChange.Set(ColumnChanges.NonPrimary);
     }
     else if (!old.IsPrimaryKey && @new.IsPrimaryKey)
     {
         metaChange.Set(ColumnChanges.PrimaryKey);
     }
 }
示例#2
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckUnique(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (old.IsUnique && [email protected])
     {
         metaChange.Set(ColumnChanges.NonUnique);
     }
     else if (!old.IsUnique && @new.IsUnique)
     {
         metaChange.Set(ColumnChanges.Unique);
     }
 }
示例#3
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckNullable(Column old, Column @new, ColumnMetaChange metaChange)
 {
     // Check if changed to non-nullable
     if (old.IsNullable && [email protected])
     {
         metaChange.Set(ColumnChanges.NonNull);
     }
     else if (!old.IsNullable && @new.IsNullable)
     {
         metaChange.Set(ColumnChanges.Nullable);
     }
 }
示例#4
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckDatatypeString(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (old.CharacterMaxLength != @new.CharacterMaxLength)
     {
         metaChange.Set(ColumnChanges.Length);
     }
 }
示例#5
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckDatatypeInteger(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (old.Precision != @new.Precision)
     {
         metaChange.Set(ColumnChanges.Length);
     }
 }
示例#6
0
文件: Column.cs 项目: sajens/MAIME
        // TODO: Not near all necessary checks are made. We have to decide how much to track and which flags to set on said changes.
        private static void CheckDatatype(Column old, Column @new, ColumnMetaChange metaChange)
        {
            if (old.DataType != @new.DataType)
            {
                metaChange.Set(ColumnChanges.DataType);
            }

            switch (@new.DataType)
            {
            // Integers
            case SqlDataType.TinyInt:
            case SqlDataType.SmallInt:
            case SqlDataType.Int:
            case SqlDataType.BigInt:
                CheckDatatypeInteger(old, @new, metaChange);
                break;

            // Strings/chars
            case SqlDataType.Char:
            case SqlDataType.NChar:
            case SqlDataType.NText:
            case SqlDataType.NVarChar:
            case SqlDataType.NVarCharMax:
            case SqlDataType.Text:
            case SqlDataType.VarChar:
            case SqlDataType.VarCharMax:
                CheckDatatypeString(old, @new, metaChange);
                break;


            // Date and time
            case SqlDataType.SmallDateTime:
            case SqlDataType.Timestamp:
            case SqlDataType.Date:
            case SqlDataType.Time:
            case SqlDataType.DateTimeOffset:
            case SqlDataType.DateTime2:
            case SqlDataType.DateTime:
                break;

            // Bit/binary
            case SqlDataType.VarBinaryMax:
            case SqlDataType.VarBinary:
            case SqlDataType.Binary:
            case SqlDataType.Bit:
                break;

            // Float/decimal
            case SqlDataType.Float:
            case SqlDataType.Decimal:
                break;

            // Money / precise
            case SqlDataType.Real:
            case SqlDataType.SmallMoney:
            case SqlDataType.Numeric:
            case SqlDataType.Money:
                break;
            }
        }
示例#7
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckRename(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (!old.Name.Equals(@new.Name))
     {
         metaChange.Set(ColumnChanges.Rename);
     }
 }
示例#8
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckDeletion(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (@new == null)
     {
         metaChange.Set(ColumnChanges.Deletion);
     }
 }
示例#9
0
文件: Column.cs 项目: sajens/MAIME
 private static void CheckAddition(Column old, Column @new, ColumnMetaChange metaChange)
 {
     if (old == null)
     {
         metaChange.Set(ColumnChanges.Addition);
     }
 }