Skip to content

Commit

Permalink
Add docs on unsupported features
Browse files Browse the repository at this point in the history
  • Loading branch information
nielm committed Jun 8, 2023
1 parent 88e5e34 commit b5e482e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ statements in the DDL file. This has the following implications:

* Tables and indexes must be created with a single `CREATE` statement (not by
using `CREATE` then `ALTER` statements). The exception to this is when
foreign key constraints are created - the tool supports creating them in the
table creation DDL statement, and also using `ALTER` statements.
constraints and row deletion policies are created - the tool supports creating them in the
table creation DDL statement, and also by using `ALTER` statements after the table has been created.

### Note on dropped database objects.

Expand All @@ -57,8 +57,8 @@ differences found:
* Drop Indexes.
* Drop Columns in a Table.

Foreign key constraints will always be dropped if they are not present in the
new DDL.
Constraints and row deletion policies will always be dropped if they are not
present in the new DDL.

### Note on modified indexes

Expand Down Expand Up @@ -102,12 +102,26 @@ foreign key relationship is
which would also be dropped and recreated. Therefore this option is disabled by
default, and FOREIGN KEY differences will cause the tool to fail.

## Unsupported Spanner DDL features

This tool by neccessity will lag behind the implementation of new DDL features
in Spanner. If you need this tool to support a specific feature, please log an
issue, or [implement it yourself](AddingCapabilities.md) and submit a Pull
Request.

As of the last edit of this file, the features known not to be supported are:

* Change Streams (create, drop, alter)
* `ALTER DATABASE` statements
* Default column values (`DEFAULT` clause)
* Views (create, drop, alter)

## Usage:

### Prerequisites:

Install a [JAVA development kit](https://jdk.java.net/) (supporting Java 8
or above) and [Apache Maven])(https://maven.apache.org/)
or above) and [Apache Maven](https://maven.apache.org/)

There are 2 options for running the tool: either compiling and running from
source, or by building a runnable JAR with all dependencies included and then
Expand Down Expand Up @@ -319,14 +333,14 @@ java -jar target/spanner-ddl-diff-*-jar-with-dependencies.jar \

# Apply alter statements to the database.
gcloud spanner databases ddl update "${SPANNER_DATABASE}" --instance="${SPANNER_INSTANCE}" \
--ddl="$(cat /tmp/alter.ddl)"
--ddl-file=/tmp/alter.ddl

```

## License

```
Copyright 2020 Google LLC
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.solutions.spannerddl.parser;

public
class ASTcolumn_default_clause extends SimpleNode {
public ASTcolumn_default_clause(int id) {
super(id);
throw new UnsupportedOperationException("not implemented");
}

public ASTcolumn_default_clause(DdlParser p, int id) {
super(p, id);
throw new UnsupportedOperationException("not implemented");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public void parseDDLNoDropRowDeletionPolicy() throws ParseException {
parseAndVerifyToString("ALTER TABLE Albums DROP ROW DELETION POLICY;");
}

@Test(expected = UnsupportedOperationException.class)
public void parseDDLNoDefaultValue() throws ParseException {
parseAndVerifyToString("CREATE TABLE test1 ( keycol INT64 DEFAULT (123) ) PRIMARY KEY keycol;");
}

private static void parseCheckingException(String ddlStatement, String exceptionContains) {
try {
parseAndVerifyToString(ddlStatement);
Expand Down

0 comments on commit b5e482e

Please sign in to comment.