Stored procedures/DB schema in source control

后端 未结 21 985
孤街浪徒
孤街浪徒 2020-12-04 05:56

Do you guys keep track of stored procedures and database schema in your source control system of choice?

When you make a change (add a table, update an stored proc,

21条回答
  •  难免孤独
    2020-12-04 06:32

    One thing to keep in mind with your drop/create scripts in SQL Server is that object-level permissions will be lost. We changed our standard to use ALTER scripts instead, which maintains those permissions.

    There are a few other caveats, like the fact that dropping an object drops the dependency records used by sp_depends, and creating the object only creates the dependencies for that object. So if you drop/create a view, sp_depends will no longer know of any objects referencing that view.

    Moral of the story, use ALTER scripts.

提交回复
热议问题