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

[DDL] Cleaning up primary key creation #1026

Merged
merged 5 commits into from
Nov 9, 2024
Merged

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Nov 8, 2024

Standing up a function for determining whether we should be creating primary keys or not.

@@ -112,3 +116,114 @@ func (d *DDLTestSuite) TestCreateTemporaryTable() {
assert.Contains(d.T(), bqQuery, "CREATE TABLE IF NOT EXISTS `db`.`schema`.`tempTableName` (`foo` string,`bar` float64,`select` string) OPTIONS (expiration_timestamp =")
}
}

func (d *DDLTestSuite) Test_DropTemporaryTableCaseSensitive() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No changes to these tests. I just moved them from ddl_test.go

@@ -1,123 +1,40 @@
package ddl_test
package ddl
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note the pkg name change. I moved all the other tests out so that we can have this be ddl. That way, we can have shouldCreatePrimaryKey remain a private function.

Once this PR merges, I'm going to try to remove the need for us to specify a different package name.

@Tang8330 Tang8330 marked this pull request as ready for review November 8, 2024 02:55
@Tang8330 Tang8330 requested a review from a team as a code owner November 8, 2024 02:55
@Tang8330 Tang8330 requested a review from danafallon November 8, 2024 02:55
@@ -73,6 +72,11 @@ func (c *Column) ToLowerName() {
c.name = strings.ToLower(c.name)
}

// SetPrimaryKey is used for tests only.
func (c *Column) SetPrimaryKey(primaryKey bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could name this SetPrimaryKeyForTest so it's extra clear that we shouldn't use it outside of tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sgtm

@Tang8330 Tang8330 merged commit 88a24e2 into master Nov 9, 2024
3 checks passed
@Tang8330 Tang8330 deleted the cleanup-primary-key-creation branch November 9, 2024 00:01
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.

2 participants