Features News Tutorials

Don’t Lose Your Work! Stay Safe With DataGrip

We’ve all been in situations where we thought we lost something forever, a text file or a photo, perhaps. But then somehow we found a way to recover it. The relief you feel in that moment can stay with you for a long time. 

DataGrip can be a really powerful tool for recovering your queries, even if it can’t recover all your data. Read on to learn about what it can do.

Query history

DataGrip saves all the queries you run. To view the query history for the current data source, click the Clock button on the console’s toolbar.

Text search is available in this window to help you find queries.

To paste a query in the editor, simply double-click it.

Queries Log

Any queries that DataGrip runs against your databases are stored in the database.log file. They can be accessed in Help | Show SQL log. This file can show you what DataGrip actually does under the hood, but it can also help you restore a query from your history if you don’t remember where and when you ran it last.

You can attach the folder with this log file to the Files tool window in DataGrip. This will make accessing the log easier, and the log itself will be properly highlighted when opened inside the IDE.

Local history

Imagine you created a query but you’ve never run it. Is it possible to bring it back? Yes, it is – with the help of Local History. DataGrip tracks the changes made to your source files, protecting you from any accidental losses or modifications, even if they were made by other applications.

Our upcoming 2021.2 version will introduce text search throughout Local History versions, so finding lost pieces of code will become even easier.

Local history for folders

Local History also works for folder contents – if you manipulate files from DataGrip’s Files tool window, that is. You can use Local History to restore deleted files.

Recent files

Instead of deleting things, we often just close files that had some important info, and then it seems like it’s been lost.

Please rest assured that everything is saved automatically in DataGrip. You might as well forget the Ctrl/Cmd+S shortcut or remap it to some other, more useful action!

If closing a regular SQL file doesn’t seem dangerous, closing console files is more stressful, as they appear to be temporary. But actually, all console files are stored locally on your machine and can be opened again.

To open any tab you’ve closed by mistake, use Recent Files (press Ctrl/Cmd+E)

With both auto-saving and Local History available, peace of mind should finally be possible. What happens in DataGrip stays in DataGrip!

Clipboad history

Sometimes you copy things to the clipboard and forget to paste them where you meant to. And then you copy other things to the clipboard, which of course overwrites the contents.

As yet another safety net, DataGrip keeps a record of the items you copy to the clipboard. It starts doing this as soon as you launch the IDE and clears the clipboard history after you close it.

Use Ctrl/Cmd+Shift+V to bring up the Clipboard history and then choose what you want to paste from it.

We hope you never lose any important data, but in the event that you do, be sure to check whether DataGrip has a way to recover it. You just might save yourself a lot of hassle.

And don’t forget to backup your database regularly! Better safe than sorry.

The DataGrip team

image description