What are the challenges you face when working across database platforms? Take the survey
Options

Find a Deleted object

A View was deleted, and we're not sure when. Using Source Control it's easy to check the history for an existing object. How does one find a deleted object? It's got to be somewhere in the Source Control history. We don't see a way to search the revision history. We could scroll through each and every revision for drops, but that's a bit tedious and would take longer than just starting over. Thanks,

Answers

  • Options
    AlexYatesAlexYates Posts: 264 Rose Gold 2
    What underlying source control system are you using with Redgate? Git? TFVC? SVN?

    Might be easier to use the underlying source control tool.
    Alex Yates
    DevOps Mentor and Coach

    Director of DLM Consultants
    Creator of Speaking Mentors
    Microsoft Data Platform MVP
    Friend of Redgate
    Twitter / LinkedIn
  • Options
    michaelmmmichaelmm Posts: 14 Bronze 3
    Good point. We already got it back. We occasionally check Source Control and had initially started there.
  • Options
    AlexYatesAlexYates Posts: 264 Rose Gold 2
    Might be worth thinking about using tSQLt to create some basic unit tests.

    Or, if accidental drops are a regular issue for you, you could automated a test on your build server to throw a warning whenever an object is dropped. There are a few ways to achieve that.
    Alex Yates
    DevOps Mentor and Coach

    Director of DLM Consultants
    Creator of Speaking Mentors
    Microsoft Data Platform MVP
    Friend of Redgate
    Twitter / LinkedIn
  • Options
    michaelmmmichaelmm Posts: 14 Bronze 3
    edited January 17, 2021 6:39PM
    This is definitely not a regular issue. Thus the moment of uh oh. I almost didn't ask the question because I find it slightly embarrassing, but I was curious if Source Control had the feature. As I mentioned we got it back. :-) Thanks.
  • Options
    AlexYatesAlexYates Posts: 264 Rose Gold 2
    Ha ha!

    Still, I like the philosophy of every time you hit a bug/error, write a test to avoid it repeating. 😝
    Alex Yates
    DevOps Mentor and Coach

    Director of DLM Consultants
    Creator of Speaking Mentors
    Microsoft Data Platform MVP
    Friend of Redgate
    Twitter / LinkedIn
  • Options
    Hi @michaelmm ,

    Thanks for reporting this. I see why it seems like the history feature would solve this in SQL Source Control, but it doesn't. This is very helpful feedback for us in thinking through user stories for viewing version control history. 

    I am not sure if you are using this in an automation context, but one other scenario we are currently working on is more flexible alerting of commands like DROP, TRUNCATE, RENAME in automation contexts-- say to possibly warn or fail on a build when these keywords are present. (I don't mean that would negate the value of viewing history to find when something was dropped or renamed, but it seems like a complimentary feature and both would be desirable.)

    Cheers,
    Kendra
  • Options
    HorstKleinHorstKlein Posts: 2 New member
    As I understand this discussion, is there currently no solution to retrieve a deleted Db object (e.g. View, SP, or Table)?
    We also have the great need to be able to use such a feature (we use SVN). Are there any plans to enable this, if so, when will the feature come?

  • Options
    Hi @HorstKlein

    Currently with the SQL Source Control object history feature you can either:
    1. View the history of an existing object
    2. View the history of the database by commit message
    You can find the history of a deleted database object via the second option, but it may be somewhat cumbersome/ tedious to find.

    I explain this to say that there is a solution for this, but it will generally only be efficient if you are looking for something that happened in a recent commit OR if commit messages can be relied on to indicate when drops occurred.

    I've searched our User Voice forum and I don't see that we've had this as a feature request before from folks. If you wouldn't mind creating an item there, it would help us to track the request. If you can describe how often you use the object history feature and if you have any policies/process/change requirements around dropping or renaming objects, that would also be really useful for us.

    Kendra
  • Options
    HorstKleinHorstKlein Posts: 2 New member
    edited January 26, 2021 9:28AM
    Hi Kendra
    Thank you for your swirt answer.
    Best regards
    Horst
Sign In or Register to comment.