Skip to content

Commit 84e2044

Browse files
committed
Update toc in front-matter
Previously, there were multiple ways for a page to have a toc. Now, the only way is if `toc: true` is in the front-matter. This PR makes this change and adds the script that was used to do so.
1 parent a2d2d8c commit 84e2044

File tree

852 files changed

+864
-1696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

852 files changed

+864
-1696
lines changed

scripts/front-matter.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
from os import listdir
3+
from os.path import isfile, join
4+
5+
directories = ["../v1.0/", "../v1.1/", "../v1.1/architecture/", "../v1.1/training/", "../v2.0/", "../v2.0/architecture/", "../v2.0/training/", "../v2.1/", "../v2.1/architecture/", "../v2.1/training/"]
6+
7+
for d in directories:
8+
onlyfiles = [f for f in listdir(d) if isfile(join(d, f))]
9+
for file in onlyfiles:
10+
filename = d + file
11+
with open(filename, "r+") as f:
12+
source = f.readlines()
13+
if '<div id="toc"></div>\n' in source:
14+
os.remove(filename)
15+
new_file = open(filename, "a")
16+
for line in source:
17+
if line == "toc: false\n":
18+
new_file.write("toc: true\n")
19+
elif line != '<div id="toc"></div>\n':
20+
new_file.write(line)

v1.0/add-column.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
title: ADD COLUMN
33
summary: Use the ADD COLUMN statement to add columns to tables.
4-
toc: false
4+
toc: true
55
---
66

77
The `ADD COLUMN` [statement](sql-statements.html) is part of `ALTER TABLE` and adds columns to tables.
88

9-
<div id="toc"></div>
109

1110
## Synopsis
1211

v1.0/add-constraint.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: ADD CONSTRAINT
33
summary: Use the ADD CONSTRAINT statement to add constraints to columns.
4-
toc: false
4+
toc: true
55
---
66

77
The `ADD CONSTRAINT` [statement](sql-statements.html) is part of `ALTER TABLE` and can add the following [constraints](constraints.html) to columns:
@@ -13,7 +13,6 @@ The `ADD CONSTRAINT` [statement](sql-statements.html) is part of `ALTER TABLE` a
1313
{{site.data.alerts.callout_info}}
1414
The <a href="primary-key.html">Primary Key</a> and <a href="not-null.html">Not Null</a> constraints can only be applied through <a href="create-table.html"><code>CREATE TABLE</code></a>. The <a href="default-value.html">Default</a> constraint is managed through <a href="alter-column.html"><code>ALTER COLUMN</code>.</a>{{site.data.alerts.end}}
1515

16-
<div id="toc"></div>
1716

1817
## Synopsis
1918

v1.0/alter-column.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: ALTER COLUMN
33
summary: Use the ALTER COLUMN statement to change a column's Default constraint.
4-
toc: false
4+
toc: true
55
---
66

77
The `ALTER COLUMN` [statement](sql-statements.html) is part of `ALTER TABLE` and changes a column's [Default constraint](default-value.html) or drops the [Not Null constraint](not-null.html).
88

99
{{site.data.alerts.callout_info}}To manage other constraints, see <a href="add-constraint.html"><code>ADD CONSTRAINT</code></a> and <a href="drop-constraint.html"><code>DROP CONSTRAINT</code></a>{{site.data.alerts.end}}
1010

11-
<div id="toc"></div>
1211

1312
## Synopsis
1413

v1.0/alter-view.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: ALTER VIEW
33
summary: The ALTER VIEW statement changes the name of a view.
4-
toc: false
4+
toc: true
55
---
66

77
The `ALTER VIEW` [statement](sql-statements.html) changes the name of a [view](views.html).
88

99
{{site.data.alerts.callout_info}}It is not currently possible to change the <code>SELECT</code> statement executed by a view. Instead, you must drop the existing view and create a new view. Also, it is not currently possible to rename a view that other views depend on, but this ability may be added in the future (see <a href="https://github.com/cockroachdb/cockroach/issues/10083">this issue</a>).{{site.data.alerts.end}}
1010

11-
<div id="toc"></div>
1211

1312
## Required Privileges
1413

v1.0/backup.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: BACKUP
33
summary: Back up your CockroachDB cluster to a cloud storage services such as AWS S3, Google Cloud Storage, or other NFS.
4-
toc: false
4+
toc: true
55
---
66

77
{{site.data.alerts.callout_danger}}The <code>BACKUP</code> feature is only available to <a href="https://www.cockroachlabs.com/pricing/">enterprise license</a> users. For non-enterprise backups, see <a href="sql-dump.html"><code>cockroach dump</code></a>.{{site.data.alerts.end}}
@@ -10,7 +10,6 @@ CockroachDB's `BACKUP` [statement](sql-statements.html) creates full or incremen
1010

1111
Because CockroachDB is designed with high fault tolerance, these backups are designed primarily for disaster recovery (i.e., if your cluster loses a majority of its nodes) through [`RESTORE`](restore.html). Isolated issues (such as small-scale node outages) do not require any intervention.
1212

13-
<div id="toc"></div>
1413

1514
## Functional Details
1615

v1.0/begin-transaction.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: BEGIN
33
summary: Initiate a SQL transaction with the BEGIN statement in CockroachDB.
4-
toc: false
4+
toc: true
55
---
66

77
The `BEGIN` [statement](sql-statements.html) initiates a [transaction](transactions.html), which either successfully executes all of the statements it contains or none at all.
88

99
{{site.data.alerts.callout_danger}}When using transactions, your application should include logic to <a href="transactions.html#transaction-retries">retry transactions</a> that are aborted to break a dependency cycle between concurrent transactions.{{site.data.alerts.end}}
1010

11-
<div id="toc"></div>
1211

1312
## Synopsis
1413

v1.0/bool.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
title: BOOL
33
summary: The BOOL data type stores Boolean values of false or true.
4-
toc: false
4+
toc: true
55
---
66

77
The `BOOL` [data type](data-types.html) stores a Boolean value of `false` or `true`.
88

9-
<div id="toc"></div>
109

1110
## Aliases
1211

v1.0/build-a-c++-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Build a C++ App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple C++ application with a low-level client driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

88
This tutorial shows you how build a simple C++ application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the [C++ libpqxx driver](https://github.com/jtv/libpqxx), so that driver is featured here.
99

10-
<div id="toc"></div>
1110

1211
## Before You Begin
1312

v1.0/build-a-clojure-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Build a Clojure App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Clojure application with a low-level client driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

88
This tutorial shows you how build a simple Clojure application with CockroachDB using [leiningen](https://leiningen.org/) and a PostgreSQL-compatible driver. We've tested and can recommend the [Clojure java.jdbc driver](http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html) in conjunction with the [PostgreSQL JDBC driver](https://jdbc.postgresql.org/), so that driver is featured here.
99

10-
<div id="toc"></div>
1110

1211
## Before You Begin
1312

v1.0/build-a-go-app-with-cockroachdb-gorm.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Go App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Go application with the GORM ORM.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -14,7 +14,6 @@ This tutorial shows you how build a simple Go application with CockroachDB using
1414

1515
{{site.data.alerts.callout_success}}For a more realistic use of GORM with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}
1616

17-
<div id="toc"></div>
1817

1918
## Before You Begin
2019

v1.0/build-a-go-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Go App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Go application with the Go pq driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -12,7 +12,6 @@ twitter: false
1212

1313
This tutorial shows you how build a simple Go application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Go pq driver](https://godoc.org/github.com/lib/pq) and the [GORM ORM](http://jinzhu.me/gorm/), so those are featured here.
1414

15-
<div id="toc"></div>
1615

1716
## Before You Begin
1817

v1.0/build-a-java-app-with-cockroachdb-hibernate.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Java App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Java application with the Hibernate ORM.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -14,7 +14,6 @@ This tutorial shows you how build a simple Java application with CockroachDB usi
1414

1515
{{site.data.alerts.callout_success}}For a more realistic use of Hibernate with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}
1616

17-
<div id="toc"></div>
1817

1918
## Before You Begin
2019

v1.0/build-a-java-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Java App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Java application with the jdbc driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -12,7 +12,6 @@ twitter: false
1212

1313
This tutorial shows you how build a simple Java application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Java jdbc driver](https://jdbc.postgresql.org/) and the [Hibernate ORM](http://hibernate.org/), so those are featured here.
1414

15-
<div id="toc"></div>
1615

1716
## Before You Begin
1817

v1.0/build-a-nodejs-app-with-cockroachdb-sequelize.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Node.js App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Node.js application with the Sequelize ORM.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -14,7 +14,6 @@ This tutorial shows you how build a simple Node.js application with CockroachDB
1414

1515
{{site.data.alerts.callout_success}}For a more realistic use of Sequelize with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}
1616

17-
<div id="toc"></div>
1817

1918
## Before You Begin
2019

v1.0/build-a-nodejs-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Node.js App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Node.js application with the Node.js pg driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -12,7 +12,6 @@ twitter: false
1212

1313
This tutorial shows you how build a simple Node.js application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Node.js pg driver](https://www.npmjs.com/package/pg) and the [Sequelize ORM](http://docs.sequelizejs.com/en/v3/), so those are featured here.
1414

15-
<div id="toc"></div>
1615

1716
## Before You Begin
1817

v1.0/build-a-php-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Build a PHP App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple PHP application with a low-level client driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

88
This tutorial shows you how build a simple PHP application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the [php-pgsql driver](http://php.net/manual/en/book.pgsql.php), so that driver is featured here.
99

10-
<div id="toc"></div>
1110

1211
## Before You Begin
1312

v1.0/build-a-python-app-with-cockroachdb-sqlalchemy.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Python App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Python application with the SQLAlchemy ORM.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -14,7 +14,6 @@ This tutorial shows you how build a simple Python application with CockroachDB u
1414

1515
{{site.data.alerts.callout_success}}For a more realistic use of SQLAlchemy with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}
1616

17-
<div id="toc"></div>
1817

1918
## Before You Begin
2019

v1.0/build-a-python-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Python App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Python application with the psycopg2 driver.
4-
toc: false
4+
toc: true
55
asciicast: true
66
twitter: false
77
---
@@ -13,7 +13,6 @@ twitter: false
1313

1414
This tutorial shows you how build a simple Python application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Python psycopg2 driver](http://initd.org/psycopg/docs/) and the [SQLAlchemy ORM](https://docs.sqlalchemy.org/en/latest/), so those are featured here.
1515

16-
<div id="toc"></div>
1716

1817
## Before You Begin
1918

v1.0/build-a-ruby-app-with-cockroachdb-activerecord.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Ruby App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Ruby application with the ActiveRecord ORM.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -14,7 +14,6 @@ This tutorial shows you how build a simple Ruby application with CockroachDB usi
1414

1515
{{site.data.alerts.callout_success}}For a more realistic use of ActiveRecord with CockroachDB, see our <a href="https://github.com/cockroachdb/examples-orms"><code>examples-orms</code></a> repository.{{site.data.alerts.end}}
1616

17-
<div id="toc"></div>
1817

1918
## Before You Begin
2019

v1.0/build-a-ruby-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Build a Ruby App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Ruby application with the pg client driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

@@ -12,7 +12,6 @@ twitter: false
1212

1313
This tutorial shows you how build a simple Ruby application with CockroachDB using a PostgreSQL-compatible driver or ORM. We've tested and can recommend the [Ruby pg driver](https://rubygems.org/gems/pg) and the [ActiveRecord ORM](http://guides.rubyonrails.org/active_record_basics.html), so those are featured here.
1414

15-
<div id="toc"></div>
1615

1716
## Before You Begin
1817

v1.0/build-a-rust-app-with-cockroachdb.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
22
title: Build a Rust App with CockroachDB
33
summary: Learn how to use CockroachDB from a simple Rust application with a low-level client driver.
4-
toc: false
4+
toc: true
55
twitter: false
66
---
77

88
This tutorial shows you how build a simple Rust application with CockroachDB using a PostgreSQL-compatible driver. We've tested and can recommend the <a href="https://crates.io/crates/postgres/" data-proofer-ignore>Rust postgres driver</a>, so that driver is featured here.
99

10-
<div id="toc"></div>
1110

1211
## Before You Begin
1312

v1.0/bytes.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
title: BYTES
33
summary: The BYTES data type stores binary strings of variable length.
4-
toc: false
4+
toc: true
55
---
66

77
The `BYTES` [data type](data-types.html) stores binary strings of variable length.
88

9-
<div id="toc"></div>
109

1110
## Aliases
1211

v1.0/check.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
title: CHECK Constraint
33
summary: The CHECK constraint specifies that values for the column in INSERT or UPDATE statements must satisfy a Boolean expression.
4-
toc: false
4+
toc: true
55
---
66

77
The `CHECK` [constraint](constraints.html) specifies that values for the column in [`INSERT`](insert.html) or [`UPDATE`](update.html) statements must return `TRUE` or `NULL` for a Boolean expression. If any values return `FALSE`, the entire statement is rejected.
88

9-
<div id="toc"></div>
109

1110
## Details
1211

0 commit comments

Comments
 (0)