Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Regex pattern for table name and primary key, allow numbers and mixed… #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

recurlybrad
Copy link

Provided example vitess code vtcompose.go contains a few bugs that should be fixed.

Regex pattern for table name: allow numbers and mixed-case, remove dash (-).

Strip ` from primary key field name.

…-case, remove dash (-), strip ` appropriately
@@ -311,7 +311,7 @@ func getTableName(sqlFile string) string {
log.Fatalf("reading sqlFile file %s: %s", sqlFile, err)
}

r, _ := regexp.Compile("CREATE TABLE ([a-z_-]*) \\(")
Copy link
Author

Choose a reason for hiding this comment

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

Expression should not consider dash (-) to be a valid character in a table name.

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

Successfully merging this pull request may close these issues.

1 participant