File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1344 TILs and counting..._
13
+ _ 1345 TILs and counting..._
14
14
15
15
---
16
16
@@ -1551,6 +1551,7 @@ _1344 TILs and counting..._
1551
1551
1552
1552
- [ Change Window Name In iTerm] ( workflow/change-window-name-in-iterm.md )
1553
1553
- [ Convert An ePub Document To PDF On Mac] ( workflow/convert-an-epub-document-to-pdf-on-mac.md )
1554
+ - [ Create A Local Sanity Dataset Backup] ( workflow/create-a-local-sanity-dataset-backup.md )
1554
1555
- [ Create A Public URL For A Local Server] ( workflow/create-a-public-url-for-a-local-server.md )
1555
1556
- [ Enable Dev Tools For Safari] ( workflow/enable-dev-tools-for-safari.md )
1556
1557
- [ Forward Stripe Events To Local Server] ( workflow/forward-stripe-events-to-local-server.md )
Original file line number Diff line number Diff line change
1
+ # Create A Local Sanity Dataset Backup
2
+
3
+ Let's say you've put together a script that is going to mutate some data in
4
+ your production dataset on Sanity. Before you run that script, it would be
5
+ prudent to capture a backup in case something goes wrong. That way you can
6
+ always restore to how the data was in the event that you need to.
7
+
8
+ You can do this from the command line with the ` sanity ` CLI.
9
+
10
+ First, ensure you are signed in via the CLI.
11
+
12
+ ``` bash
13
+ $ sanity login
14
+ ```
15
+
16
+ Then, you can issue the ` dataset export ` command, naming the dataset (in this
17
+ case, ` production ` ) to target and the name of the backup file to be created
18
+ locally.
19
+
20
+ ``` bash
21
+ $ sanity dataset export production my-project-backup.tar.gz
22
+ ```
23
+
24
+ I believe the Sanity CLI goes off the ` sanity.cli.{ts,js} ` file in your local
25
+ project directory to determine what Sanity project it should be working with.
26
+
27
+ See the [ ` export dataset ` ] ( https://www.sanity.io/docs/dataset#fd38ca03b011 )
28
+ docs for more details.
You can’t perform that action at this time.
0 commit comments