public virtual string HandleNullable(IHasNullable item) { return(!item.Nullable ? "NOT NULL" : null); }
public override IEnumerable <Command> HandleAlterNullable(Identifier fieldName, Identifier relationName, IHasNullable nullable, IHasNullable otherNullable) { if (otherNullable.Nullable != nullable.Nullable) { var builder = new StringBuilder(); builder.Append("ALTER "); builder.Append(relationName != null ? $"TABLE {relationName} ALTER {fieldName}" : $"DOMAIN {fieldName}"); builder.Append($" {(nullable.Nullable ? "DROP" : "SET")} NOT NULL"); yield return(new Command().Append(builder.ToString())); } }
public virtual IEnumerable <Command> HandleAlterNullable(Identifier fieldName, Identifier relationName, IHasNullable nullable, IHasNullable otherNullable) { if (otherNullable.Nullable != nullable.Nullable) { var systemTableName = relationName != null ? "RDB$RELATION_FIELDS" : "RDB$FIELDS"; var builder = new StringBuilder(); builder .Append($"UPDATE {systemTableName}") .AppendLine() .Append($" SET RDB$NULL_FLAG = {(nullable.Nullable ? "NULL" : "1")}") .AppendLine() .Append($"WHERE RDB$FIELD_NAME = '{fieldName}'"); if (relationName != null) { builder.Append($" AND RDB$RELATION_NAME = '{relationName}'"); } yield return(new Command().Append(builder.ToString())); } }