Skip to content

Commit

Permalink
Add docs for VSchema DDL (#1575)
Browse files Browse the repository at this point in the history
Co-authored-by: Deepthi Sigireddi <[email protected]>
  • Loading branch information
davidpiegza and deepthi authored Sep 21, 2023
1 parent 039e3f2 commit cc4ec07
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Going cross-cell for non-primary requests is an advanced use case that requires

For those who wish to use the MySQL protocol, you must specify a `mysql_server_port` and a `mysql_auth_server_impl` for configuring authentication. Predefined auth servers are `clientcert`, `static`, `ldap` and `none`. The most commonly used authentication is `static` that allows you to specify the credentials through a `mysql_auth_server_static_file` parameter.

The `vschema_ddl_authorized_users` specifies which users can alter the vschema by issuing “vschema ddls” directly to vtgate. VSchema DDL is an experimental feature that will be documented soon.
The `vschema_ddl_authorized_users` specifies which users can alter the vschema by issuing “[vschema ddls](../../vschema-guide/vschema_ddl)” directly to vtgate. VSchema DDL is an experimental feature.

Here are the contents of an example file that shows the ability to specify MySQL native passwords as well as plain text:

Expand All @@ -56,7 +56,7 @@ Here are the contents of an example file that shows the ability to specify MySQL
}
],
"mysql_user2": [
{
{
"Password": "mysql_password",
"UserData": "mysql_user"
}
Expand Down
112 changes: 112 additions & 0 deletions content/en/docs/18.0/user-guides/vschema-guide/vschema_ddl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: VSchema DDL
weight: 30
---

VSchema DDL is an experimental feature that allows users to alter the VSchema by issuing "vschema ddls" directly to vtgate. The `vschema_ddl_authorized_users` flag specifies which users can alter the vschema.

### SHOW VSCHEMA TABLES

```
SHOW VSCHEMA TABLES
```

Shows tables in VSchema.

### SHOW VSCHEMA VINDEXES

```
SHOW VSCHEMA VINDEXES
```

Shows all vindexes in VSchema.

### SHOW VSCHEMA VINDEXES FROM tbl_name

```
SHOW VSCHEMA VINDEXES [FROM | ON] tbl_name
```

Shows vindexes from table `tbl_name` in VSchema.

### ALTER VSCHEMA ADD TABLE

```
ALTER VSCHEMA ADD TABLE {keyspace_name.tbl_name | tbl_name}
```

Adds the given table to the VSchema for the current keyspace.

### ALTER VSCHEMA DROP TABLE

```
ALTER VSCHEMA DROP TABLE {keyspace_name.tbl_name | tbl_name}
```

Drops the table from the VSchema for the current keyspace.

### ALTER VSCHEMA CREATE VINDEX

```
ALTER VSCHEMA CREATE VINDEX vindex_name USING vindex_type [WITH vindex_option[, vindex_option] ...]
vindex_option: {
name = value
}
```

Creates a vindex with the specified `vindex_type` and `vindex_option`s.

For the various vindex types and vindex options see [Vindexes documentation](https://vitess.io/docs/17.0/reference/features/vindexes/#predefined-vindexes).

### ALTER VSCHEMA DROP VINDEX

```
ALTER VSCHEMA DROP VINDEX vindex_name
```

Drops a vindex from the VSchema.

### ALTER VSCHEMA ON tbl_name ADD VINDEX

```
ALTER VSCHEMA ON tbl_name ADD VINDEX tbl_name.vindex_name (column_name[, column_name] ...) [USING vindex_type] [WITH vindex_option[, vindex_option] ...]
```

Adds a vindex for table `tbl_name` and columns `column_name`.

For the various vindex types and vindex options see [Vindexes documentation](https://vitess.io/docs/17.0/reference/features/vindexes/#predefined-vindexes).


### ALTER VSCHEMA ON tbl_name REMOVE VINDEX

```
ALTER VSCHEMA ON tbl_name REMOVE VINDEX tbl_name.vindex_name
```

Removes a vindex from table `tbl_name`.


### ALTER VSCHEMA ADD SEQUENCE

```
ALTER VSCHEMA ADD SEQUENCE tbl_name.seq_name
```

### ALTER VSCHEMA DROP SEQUENCE

```
ALTER VSCHEMA DROP SEQUENCE tbl_name.seq_name
```

### ALTER VSCHEMA ON ... ADD AUTO_INCREMENT

```
ALTER VSCHEMA ON tbl_name ADD AUTO_INCREMENT column_name USING tbl_name.seq_name
```

### ALTER VSCHEMA ON ... DROP AUTO_INCREMENT

```
ALTER VSCHEMA ON tbl_name DROP AUTO_INCREMENT
```

0 comments on commit cc4ec07

Please sign in to comment.