Skip to content

Commit

Permalink
added doc for check constraints
Browse files Browse the repository at this point in the history
1. added documentation for check constraints
  • Loading branch information
Vivek Yadav committed Jan 3, 2025
1 parent fd8f614 commit 207f630
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/data-types/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ and `ON UPDATE` actions, we drop them.
While Spanner supports default values, Spanner migration tool currently does not support translating source `DEFAULT` constraints to Spanner `DEFAULT` constraints. We drop the `DEFAULT` MySQL constraint during conversion.
It can be manually added to the DDL via an `ALTER TABLE` command.

## Check Constraints

While spanner supports check constraints, Spanner migration tool currently migrate all existing mysql check constraint to spanner. The non supported constraints can be drop manually.
Note: This feature is only available for MySQL versions 8.0.16 and above. For versions below this, users can manually add check constraints using the Spanner migration tool (SMT).

## Secondary Indexes

The tool maps MySQL secondary indexes to Spanner secondary indexes, and preserves
Expand Down
2 changes: 1 addition & 1 deletion docs/limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Please refer to the [issues section](https://github.com/GoogleCloudPlatform/span

- Schema Only Mode does not create foreign keys
- Foreign key actions such as [ON DELETE CASCADE](https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#create_table) are not supported. If you do not specify a foreign key action, Spanner infers NO ACTION as the default action
- Migration of check constraints, functions and views is not supported
- Migration of functions and views is not supported
- Schema recommendations are based on static analysis of the schema only
- PG Spanner dialect support is limited, and is not currently available on the UI

Expand Down
1 change: 1 addition & 0 deletions docs/ui/schema-conv/schema-conv.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ In the configure schema page, the user can view details of the source database a
1. Primary Key
1. Foreign Key
1. Interleave
1. Check Constraints
1. SQL
1. Index details
1. Sequence Details (Only for Source DB MySql)
Expand Down
11 changes: 11 additions & 0 deletions docs/ui/schema-conv/spanner-draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ To interleave a `child table` within a `parent table`, the following conditions

4. Use the modified session file in the [SMT commands](../../cli/cli.md) or it can be imported via [SMT UI](../connect-source.md#load-session-file) and proceed further.

### Check Constraints
Users can view and edit the check constraints of a table from the check constraints tab. They can modify the check constraint name, condition and drop the check constraint. Once these changes are made the [session file](../ui.md/#termsterminology) is updated.

![](https://services.google.com/fh/files/misc/cc3.png)
![](https://services.google.com/fh/files/misc/cc4.png)

#### Add Constraints
In addition to editing the existing check constraint in the Spanner draft mapped from the source database, users can also add new constraint to the selected table.

![](https://services.google.com/fh/files/misc/cc2.png)
![](https://services.google.com/fh/files/misc/cc1.png)

### SQL

Expand Down

0 comments on commit 207f630

Please sign in to comment.