In the next version of my app, I need to update a column from NVarChar(16) to NVarChar(255) on one of the tables in my local database. Currently the column is marked up as follows:
[global::System.Data.Linq.Mapping.TableAttribute()]
public partial class Message : INotifyPropertyChanged
{
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "NVarChar(16) NOT NULL", CanBeNull = false)]
public string Name
{
...
}
}
All examples that I've seen point to the DatabaseSchemaUpdater class, however, it has methods to Add a column, but none to update the length of the column.
How do I update the column length?
It turns out the API does not allow you to do that. Or drop columns. The only thing you could do is add a new column (it must be nullable for some reason), use it and ignore the ones you no longer want.
Weak API design.