Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2]change unsupported DDL behavior #137

Conversation

nktks
Copy link
Contributor

@nktks nktks commented Feb 13, 2024

We would like to skip when schema file includes CREATE CHANGE STREAM statements in v2.
Instead of #116 ,
I change code to skip when schema file includes statement which can parse and unsupported in yo v2 as v1 do.

@@ -58,13 +59,16 @@ func NewSchemaParserSource(fpath string) (SchemaSource, error) {
v := tables[tableName]
v.createIndexes = append(v.createIndexes, val)
tables[tableName] = v
case *spansql.CreateChangeStream:
log.Printf("skipped. CreateChangeStream isn't supported yet. got ' %s'", ddlstmt.SQL())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line. (If we do this, it's better to implement warning and it should output to stderr)

default:
return nil, fmt.Errorf("stmt should be CreateTable, CreateIndex or AlterTableAddForeignKey, but got '%s'", ddlstmt.SQL())
return nil, fmt.Errorf("stmt should be CreateTable, CreateIndex, CreateChangeStream or AlterTableAddForeignKey, but got '%s'", ddlstmt.SQL())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's difficult to manage all expected key words here. Please change like this.

fmt.Errorf("unknown statement is specified: %s", ddlstmt.SQL())

case *spansql.AlterTable:
if isAlterTableAddFK(val) {
continue
}
return nil, fmt.Errorf("stmt should be CreateTable, CreateIndex or AlterTableAddForeignKey, but got '%s'", ddlstmt.SQL())
return nil, fmt.Errorf("stmt should be CreateTable, CreateIndex, CreateChangeStream or AlterTableAddForeignKey, but got '%s'", ddlstmt.SQL())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf("unknown statement in AlterTable is specified: %s", ddlstmt.SQL())

@nktks nktks changed the title [v2]skip for CreateChangeStream statement [v2]change unsupported DDL behavior Feb 13, 2024
@kazegusuri kazegusuri merged commit 783883b into cloudspannerecosystem:master Feb 13, 2024
5 checks passed
@nktks nktks deleted the feature/skip-create-change-stream branch February 13, 2024 09:52
@nktks
Copy link
Contributor Author

nktks commented Feb 13, 2024

Thanks for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants