Will adding a column to table break asp.net app?
I've inherited an ASP.NET web app, and I开发者_StackOverflow社区 am coming up to speed on being a DBA as well.
Before I break anything, if I add a new column to a table, is there any chance it will break an existing page that does CRUD operations? The new column would not, of course, be part of the existing operations and grid controls, and if I allow it to contain a NULL (so inserts don't require value input), will I be OK?
I realize that deleting a column could certainly break things. But adding a nullable column would seem to be harmless enough. (I think).
But I want to check!
Thanks
Well, it depends on how well the app is written. If, for example, the code uses column numbers instead of names then it's very likely that things will break, especially if you add columns in between ones that already exist.
Hopefully your app has enough unit tests to help you try this out with confidence. If not, then maybe adding unit tests should be your first priority.
Can't you simply add the column, see if it breaks, and if it does remove the column?
If you allow the new column to be null and have a default you should be fine e.g. INSERT INTO table ('value', 'value', 'value') //would cause an error unless column has a default
精彩评论