Skip to content

Commit e0310e5

Browse files
authored
Merge pull request #2406 from dolthub/aaron/sql-dolt-backup
dolt: dolt-sql-procedures.md: Update documentation of dolt_backup to include all its functionality.
2 parents 648867d + 7639083 commit e0310e5

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

packages/dolt/content/reference/sql/version-control/dolt-sql-procedures.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,8 @@ CALL DOLT_COMMIT('-m', 'committing all changes');
112112

113113
## `DOLT_BACKUP()`
114114

115-
Sync with a configured backup. Other backup commands not supported
116-
via SQL yet.
117-
118-
```sql
119-
CALL DOLT_BACKUP('sync', 'name');
120-
```
115+
Add or remove a configured backup, sync with a configured backup, sync a backup
116+
to a remote URL, restore a remote URL backup as a new database.
121117

122118
### Output Schema
123119

@@ -129,14 +125,46 @@ CALL DOLT_BACKUP('sync', 'name');
129125
+--------+------+---------------------------+
130126
```
131127

128+
To sync the current database to configured backup:
129+
130+
```sql
131+
CALL DOLT_BACKUP('sync', 'name');
132+
```
133+
134+
To sync with a remote URL which is not configured as a backup:
135+
136+
```sql
137+
CALL DOLT_BACKUP('sync-url', 'https://dolthub.com/some_organization/some_dolthub_repository');
138+
```
139+
140+
To add and remove a configured backup:
141+
142+
```sql
143+
CALL DOLT_BACKUP('add', 'dolthub', 'https://dolthub.com/some_organization/some_dolthub_repository');
144+
145+
CALL DOLT_BACKUP('remove', 'dolthub');
146+
```
147+
148+
To restore a backup:
149+
150+
```sql
151+
CALL DOLT_BACKUP('restore', 'https://dolthub.com/some_organization/some_dolthub_repository', 'database_name');
152+
```
153+
132154
### Example
133155

134156
```sql
135157
-- Set the current database for the session
136158
USE mydb;
137159

138-
-- Upload the current database contents to the named backup
160+
-- Configure a backup to sync to.
161+
CALL dolt_backup('add', 'my-backup', 'https://dolthub.com/some_organization/some_dolthub_repository');
162+
163+
-- Upload the current database contents to that named backup
139164
CALL dolt_backup('sync', 'my-backup')
165+
166+
-- Restore the uploaded database to a new database name
167+
CALL dolt_backup('restore', 'https://dolthub.com/some_organization/some_dolthub_repository', 'mydb_restored');
140168
```
141169

142170
## `DOLT_BRANCH()`

0 commit comments

Comments
 (0)