3/31/2021 0 Comments Sql Complete Version History
I agree its not the same as Source Control, but its a valuable safety net that should not be ignored.I think you could end up using git or svn, but the best solution for me was to buy Red Gates Source Control for keeping databases (and stored procedures) under version control.
Of course source control offers much greater control and auditing, and 3rd party tools will have a lot more features than youll want to write yourself, but they dont have a way to protect you from direct changes - in other words they rely on everyone obeying the source control protocol (which isnt always feasible). Provide details and share your research But avoid Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. Not the answer youre looking for Browse other questions tagged sql-server stored-procedures or ask your own question. He is also author of various SQL Shack articles about SSIS packages and knowledgebase articles about ApexSQL Doc. For the purpose of this article well use a sample database called StoresDB whose objects are scripted in separate files and saved in a local folder called MercLocal. The same folder is initialized to be a local Mercurial repository. I wont include details about initializing the repository and committing changes. The goal of the article is to cover the following: revision history of all committed changes, comparing two versions of the same object committed in two different changesets and getting specific version of an object from the commit history. BalancesList AS BEGIN SELECT BalanceID, Description, DocID FROM dbo. The previously created BalanceType column in the Balances table is renamed using the following script. It can be started from the right click menu inside the folder initialized as a local Mercurial repository (in this case the MercLocal folder). The first commit (at the bottom of the list) shows initial commit of all database objects, followed by commits where the rest of changes are committed. The Age column stores the time that passed after the commit is performed. The Changes column at the end, shows the exact number of changes included in the specific changeset, along with the appropriate colors that represents the actions performed against committed files. ![]() The most recent commit shown on top of the list ( Rev 4 ) where 1 is highlighted in orange indicates that one object is deleted from the repository which corresponds to deleting the ShoppingCartItem table in the last commit. For the highlighted revision (in this case Rev 1) the version of an object committed in that revision will be shown in the section below. In order to show differences for the specific object, double-click that object from the list. To narrow down the comparison to a single object, select it from the list of objects in any changeset, and from the right click menu select the Compare File Revisions option. Well perform that against the dbo.Balances table from the Rev 2 revision. Both sides, left and right, shows the same list of revisions related to specific object (in this case the Balances table). To compare between revisions, simply select one on the left side, and another one on the right (well compare the version of the balances table from Rev 1 with the version from Rev 3). This means that BalancesList stored procedure will be deleted, as well as BType column that was committed in the later revision. Checking the Balances table in the local repository gives the following result. Selecting the Revert to Revision option from the right click menu gives a confirmation dialog, where optionally all object from the selected revision can be reverted (by checking the Revert all files to this revision option). In order to demonstrate reverting of a single object, this option will be unchecked. He uses his spare time to play guitar, ride a bike and hang out with his friends. During winter, he likes skiing the most, but all other snow activities, too.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |