Skip to content

Commit 3fa8381

Browse files
authored
Merge pull request #2387 from dolthub/gitbook-dev
publish
2 parents 4efb6a4 + c0c56a6 commit 3fa8381

File tree

2 files changed

+85
-77
lines changed

2 files changed

+85
-77
lines changed

packages/dolt/content/reference/sql/version-control/dolt-system-tables.md

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,49 @@ Then you can view them in `dolt_schemas`:
339339
340340
[DOLT_TAG()](./dolt-sql-procedures.md#dolt_tag) procedure can be used to INSERT and DELETE tags on the `dolt_tags` table.
341341
342+
### Schema
343+
344+
```text
345+
+----------+----------+------+-----+---------+-------+
346+
| Field | Type | Null | Key | Default | Extra |
347+
+----------+----------+------+-----+---------+-------+
348+
| tag_name | text | NO | PRI | NULL | |
349+
| tag_hash | text | NO | PRI | NULL | |
350+
| tagger | text | NO | | NULL | |
351+
| email | text | NO | | NULL | |
352+
| date | datetime | NO | | NULL | |
353+
| message | text | NO | | NULL | |
354+
+----------+----------+------+-----+---------+-------+
355+
```
356+
357+
### Example Query
358+
359+
Create a tag using dolt_tag() stored procedure.
360+
361+
```sql
362+
CALL DOLT_TAG('_migrationtest','head','-m','savepoint for migration testing');
363+
```
364+
365+
```text
366+
+--------+
367+
| status |
368+
+--------+
369+
| 0 |
370+
+--------+
371+
```
372+
373+
Get all the tags.
374+
375+
{% embed url="https://www.dolthub.com/repositories/dolthub/first-hour-db/embed/main?q=SELECT+*+FROM+dolt_tags%3B" %}
376+
342377
## `dolt_statistics`
343378
344379
`dolt_statistics` includes currently collected
345380
database statistics. This information is stored outside of the
346381
commit graph and is not subject to versioning semantics.
347382
383+
### Schema
384+
348385
```sql
349386
+-----------------+----------+------+-----+---------+-------+
350387
| Field | Type | Null | Key | Default | Extra |
@@ -371,41 +408,6 @@ commit graph and is not subject to versioning semantics.
371408
+-----------------+----------+------+-----+---------+-------+
372409
```
373410
374-
### Schema
375-
376-
```text
377-
+----------+----------+
378-
| Field | Type |
379-
+----------+----------+
380-
| tag_name | text |
381-
| tag_hash | text |
382-
| tagger | text |
383-
| email | text |
384-
| date | datetime |
385-
| message | text |
386-
+----------+----------+
387-
```
388-
389-
### Example Query
390-
391-
Create a tag using dolt_tag() stored procedure.
392-
393-
```sql
394-
CALL DOLT_TAG('_migrationtest','head','-m','savepoint for migration testing');
395-
```
396-
397-
```text
398-
+--------+
399-
| status |
400-
+--------+
401-
| 0 |
402-
+--------+
403-
```
404-
405-
Get all the tags.
406-
407-
{% embed url="https://www.dolthub.com/repositories/dolthub/first-hour-db/embed/main?q=SELECT+*+FROM+dolt_tags%3B" %}
408-
409411
# Database History System Tables
410412
411413
## `dolt_blame_$tablename`
@@ -1114,8 +1116,8 @@ These tables can be modified in order to update what changes are staged for comm
11141116
### Schema
11151117
11161118
The schema of the source table is going to effect the schema of the workspace table. The first
1117-
three column are always the same, then the schema of the source table is used to create "to_" and
1118-
"from_" columns.
1119+
three column are always the same, then the schema of the source table is used to create "to\_" and
1120+
"from\_" columns.
11191121
11201122
Each row in the `dolt_workspace_$TABLENAME` corresponds to a single row update in the table.
11211123
@@ -1139,18 +1141,21 @@ workspace which means all queries in your session contain them but they will not
11391141
in the event that [`dolt_commit()`](dolt-sql-procedures.md#dolt_commit) is executed.
11401142
11411143
There are two ways you can alter the state of your workspace using these tables.
1142-
1) The `staged` column can be toggled for any row. If changing from false to true, the row values will be moved
1143-
to staging. If there are already staged changes for that row, they will be overwritten. If changing from true to
1144-
false, the row values will be unstaged. If there are other changes in the workspace for that row, the workspace
1145-
change will be preserved and the staged change will be dropped.
1146-
2) Any row which has `staged = FALSE` can be deleted. This will result in reverting the change to the row in the source table.
1144+
1145+
1. The `staged` column can be toggled for any row. If changing from false to true, the row values will be moved
1146+
to staging. If there are already staged changes for that row, they will be overwritten. If changing from true to
1147+
false, the row values will be unstaged. If there are other changes in the workspace for that row, the workspace
1148+
change will be preserved and the staged change will be dropped.
1149+
2. Any row which has `staged = FALSE` can be deleted. This will result in reverting the change to the row in the source table.
11471150
11481151
### Example Query
1152+
11491153
```sql
11501154
SELECT *
11511155
FROM dolt_workspace_mytable
11521156
WHERE staged=false
11531157
```
1158+
11541159
```text
11551160
+----+--------+-----------+-------+----------+---------+------------+
11561161
| id | staged | diff_type | to_id | to_value | from_id | from_value |
@@ -1168,6 +1173,7 @@ call dolt_commit("-m", "Added row id 3 in my table")
11681173
```
11691174
11701175
### Notes
1176+
11711177
The `dolt_workspace_$TABLENAME` tables are generated based on the session state when inspected,
11721178
so they can not be considered stable on a branch which has multiple editors.
11731179

packages/doltgres/content/reference/sql/version-control/dolt-system-tables.md

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,49 @@ Then you can view them in `dolt_schemas`:
278278

279279
[DOLT_TAG()](./dolt-sql-procedures.md#dolt_tag) procedure can be used to INSERT and DELETE tags on the `dolt_tags` table.
280280

281+
### Schema
282+
283+
```text
284+
+----------+----------+------+-----+---------+-------+
285+
| Field | Type | Null | Key | Default | Extra |
286+
+----------+----------+------+-----+---------+-------+
287+
| tag_name | text | NO | PRI | NULL | |
288+
| tag_hash | text | NO | PRI | NULL | |
289+
| tagger | text | NO | | NULL | |
290+
| email | text | NO | | NULL | |
291+
| date | datetime | NO | | NULL | |
292+
| message | text | NO | | NULL | |
293+
+----------+----------+------+-----+---------+-------+
294+
```
295+
296+
### Example Query
297+
298+
Create a tag using dolt_tag() stored procedure.
299+
300+
```sql
301+
CALL DOLT_TAG('_migrationtest','head','-m','savepoint for migration testing');
302+
```
303+
304+
```text
305+
+--------+
306+
| status |
307+
+--------+
308+
| 0 |
309+
+--------+
310+
```
311+
312+
Get all the tags.
313+
314+
{% embed url="https://www.dolthub.com/repositories/dolthub/first-hour-db/embed/main?q=SELECT+*+FROM+dolt_tags%3B" %}
315+
281316
## `dolt_statistics`
282317

283318
`dolt_statistics` includes currently collected
284319
database statistics. This information is stored outside of the
285320
commit graph and is not subject to versioning semantics.
286321

322+
### Schema
323+
287324
```sql
288325
+-----------------+----------+------+-----+---------+-------+
289326
| Field | Type | Null | Key | Default | Extra |
@@ -310,41 +347,6 @@ commit graph and is not subject to versioning semantics.
310347
+-----------------+----------+------+-----+---------+-------+
311348
```
312349

313-
### Schema
314-
315-
```text
316-
+----------+----------+
317-
| Field | Type |
318-
+----------+----------+
319-
| tag_name | text |
320-
| tag_hash | text |
321-
| tagger | text |
322-
| email | text |
323-
| date | datetime |
324-
| message | text |
325-
+----------+----------+
326-
```
327-
328-
### Example Query
329-
330-
Create a tag using dolt_tag() stored procedure.
331-
332-
```sql
333-
SELECT DOLT_TAG('_migrationtest','head','-m','savepoint for migration testing');
334-
```
335-
336-
```text
337-
+--------+
338-
| status |
339-
+--------+
340-
| 0 |
341-
+--------+
342-
```
343-
344-
Get all the tags.
345-
346-
{% embed url="https://www.dolthub.com/repositories/dolthub/first-hour-db/embed/main?q=SELECT+*+FROM+dolt_tags%3B" %}
347-
348350
# Database History System Tables
349351

350352
## `dolt_blame_$tablename`

0 commit comments

Comments
 (0)