问题
For example, I alter a column in a table to be not null from null.
I need to then delete and readd the table. That part is pretty clear.
What about views, functions, and stored procedures that access the table, especially that column in the table?
I've tried running diffs against the files generated by SQLMetal with some limited success, but even with that it's fairly unclear.
I know there is at least one commercial tool out there that claims to address this problem, but I am looking for something free.
How are people dealing with this issue?
回答1:
+1 on the question.
But what's bad about using a commercial tool if it solves the problem? After all, if you spend an hour per week on manually matching up changes instead of hitting a button that does it all for you, then the license cost of using a commercial tool will pay itself back in no time at all. All tools that address this issue cost a fraction of a Visual Studio license, have free trials, and the price is not more than an hour of work for most devs. Just my 2 cents.
That said, I agree it would be neat if this functionality was available for free. I have tried suggesting that to MSFT many times but they don't seem to be interested in that. (as in: they don't even reply back... :) )
回答2:
It seems you are putting a lot of business logic into your SQL DB rather than keeping it in the app itself. Try adopting a more DDD approach with a Domain Model - this should move much of the work those SPs and Views from the db are doing back into the application where they belong. Then your db should only be for persisting data and hence changed to tables should only require a very small amount of time in the L2S designer to make updates.
来源:https://stackoverflow.com/questions/956131/when-i-make-a-database-change-how-do-i-know-what-needs-to-be-removed-and-readde