Skip to content

Commit 655391e

Browse files
committed
Document columns in each schema.
Signed-off-by: Bradley Grainger <[email protected]>
1 parent b664e9c commit 655391e

File tree

8 files changed

+161
-6
lines changed

8 files changed

+161
-6
lines changed

docs/content/overview/schema-collections.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ weight: 80
1515

1616
`MySqlConnection.GetSchema` supports the following schemas:
1717

18-
* `MetaDataCollections`—information about available schemas
18+
* `MetaDataCollections`[information about available schemas](../schema/metadatacollections/)
1919
* `CharacterSets`
2020
* `Collations`
2121
* `CollationCharacterSetApplicability`
22-
* `Columns`
22+
* `Columns`[information about columns (in all tables)](../schema/columns/)
2323
* `Databases`
2424
* `DataSourceInformation`
25-
* `DataTypes`—information about available data types
25+
* `DataTypes`[information about available data types](../schema/datatypes/)
2626
* `Engines`
2727
* `KeyColumnUsage`
2828
* `KeyWords`
2929
* `Parameters`
3030
* `Partitions`
3131
* `Plugins`
32-
* `Procedures`—information about stored procedures
32+
* `Procedures`[information about stored procedures](../schema/procedures/)
3333
* `ProcessList`
3434
* `Profiling`
3535
* `ReferentialConstraints`
36-
* `ReservedWords`—information about reserved words in the server's SQL syntax
36+
* `ReservedWords`[information about reserved words in the server's SQL syntax](../schema/reservedwords/)
3737
* `ResourceGroups`
3838
* `SchemaPrivileges`
3939
* `Tables`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
date: 2022-07-10
3+
lastmod: 2022-07-11
4+
title: Columns Schema
5+
---
6+
7+
# Columns Schema
8+
9+
The `Columns` schema provides information about columns (in all tables).
10+
11+
Column Name | Data Type
12+
--- | ---
13+
TABLE_CATALOG | string
14+
TABLE_SCHEMA | string
15+
TABLE_NAME | string
16+
COLUMN_NAME | string
17+
ORDINAL_POSITION | uint
18+
COLUMN_DEFAULT | string
19+
IS_NULLABLE | string
20+
DATA_TYPE | string
21+
CHARACTER_MAXIMUM_LENGTH | long
22+
NUMERIC_PRECISION | ulong
23+
NUMERIC_SCALE | ulong
24+
DATETIME_PRECISION | uint
25+
CHARACTER_SET_NAME | string
26+
COLLATION_NAME | string
27+
COLUMN_TYPE | string
28+
COLUMN_KEY | string
29+
EXTRA | string
30+
PRIVILEGES | string
31+
COLUMN_COMMENT | string
32+
GENERATION_EXPRESSION | string
33+
SRS_ID | string
34+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
date: 2022-07-10
3+
lastmod: 2022-07-11
4+
title: DataTypes Schema
5+
---
6+
7+
# DataTypes Schema
8+
9+
The `DataTypes` schema provides information about available data types.
10+
11+
Column Name | Data Type
12+
--- | ---
13+
TypeName | string
14+
ProviderDbType | int
15+
ColumnSize | long
16+
CreateFormat | string
17+
CreateParameters | string
18+
DataType | string
19+
IsAutoIncrementable | bool
20+
IsBestMatch | bool
21+
IsCaseSensitive | bool
22+
IsFixedLength | bool
23+
IsFixedPrecisionScale | bool
24+
IsLong | bool
25+
IsNullable | bool
26+
IsSearchable | bool
27+
IsSearchableWithLike | bool
28+
IsUnsigned | bool
29+
MaximumScale | short
30+
MinimumScale | short
31+
IsConcurrencyType | bool
32+
IsLiteralSupported | bool
33+
LiteralPrefix | string
34+
LiteralSuffix | string
35+
NativeDataType | string
36+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
date: 2022-07-10
3+
lastmod: 2022-07-11
4+
title: MetaDataCollections Schema
5+
---
6+
7+
# MetaDataCollections Schema
8+
9+
The `MetaDataCollections` schema provides information about available schemas.
10+
11+
Column Name | Data Type
12+
--- | ---
13+
CollectionName | string
14+
NumberOfRestrictions | int
15+
NumberOfIdentifierParts | int
16+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
date: 2022-07-10
3+
lastmod: 2022-07-11
4+
title: Procedures Schema
5+
---
6+
7+
# Procedures Schema
8+
9+
The `Procedures` schema provides information about stored procedures.
10+
11+
Column Name | Data Type
12+
--- | ---
13+
SPECIFIC_NAME | string
14+
ROUTINE_CATALOG | string
15+
ROUTINE_SCHEMA | string
16+
ROUTINE_NAME | string
17+
ROUTINE_TYPE | string
18+
DTD_IDENTIFIER | string
19+
ROUTINE_BODY | string
20+
ROUTINE_DEFINITION | string
21+
EXTERNAL_NAME | string
22+
EXTERNAL_LANGUAGE | string
23+
PARAMETER_STYLE | string
24+
IS_DETERMINISTIC | string
25+
SQL_DATA_ACCESS | string
26+
SQL_PATH | string
27+
SECURITY_TYPE | string
28+
CREATED | DateTime
29+
LAST_ALTERED | DateTime
30+
SQL_MODE | string
31+
ROUTINE_COMMENT | string
32+
DEFINER | string
33+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
date: 2022-07-10
3+
lastmod: 2022-07-11
4+
title: ReservedWords Schema
5+
---
6+
7+
# ReservedWords Schema
8+
9+
The `ReservedWords` schema provides information about reserved words in the server's SQL syntax.
10+
11+
Column Name | Data Type
12+
--- | ---
13+
ReservedWord | string
14+

tools/SchemaCollectionGenerator/SchemaCollectionGenerator.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,33 @@ public async ValueTask<DataTable> GetSchemaAsync(IOBehavior ioBehavior, string c
149149
150150
");
151151
foreach (var schema in schemaCollections)
152-
docWriter.Write($@"* `{schema.Name}`{(schema.Description is not null ? "—" + schema.Description : "")}
152+
docWriter.Write($@"* `{schema.Name}`{(schema.Description is not null ? "—[" + schema.Description + "](../schema/" + schema.Name.ToLowerInvariant() + "/)" : "")}
153153
");
154154
docWriter.Write(@"
155155
The `GetSchema(string, string[])` overload that specifies restrictions is not supported.
156156
");
157157

158+
foreach (var schema in schemaCollections.Where(x => x.Description is not null))
159+
{
160+
using var schemaDocWriter = new StreamWriter($@"..\..\..\..\..\docs\content\overview\schema\{schema.Name.ToLowerInvariant()}.md");
161+
schemaDocWriter.Write($@"---
162+
date: 2022-07-10
163+
lastmod: {DateTime.UtcNow.ToString("yyyy-MM-dd")}
164+
title: {schema.Name} Schema
165+
---
166+
167+
# {schema.Name} Schema
168+
169+
The `{schema.Name}` schema provides {schema.Description}.
170+
171+
Column Name | Data Type
172+
--- | ---
173+
");
174+
foreach (var column in schema.Columns)
175+
schemaDocWriter.WriteLine($@"{column.Name} | {column.Type}");
176+
schemaDocWriter.WriteLine();
177+
}
178+
158179
class Schema
159180
{
160181
[AllowNull]

tools/SchemaCollectionGenerator/SchemaCollections.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
- name: Columns
4848
table: COLUMNS
49+
description: information about columns (in all tables)
4950
restrictions:
5051
- name: Catalog
5152
default: TABLE_CATALOG

0 commit comments

Comments
 (0)