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

Add id column in migrations table for MySQL Group Replication #2772

Closed
wants to merge 2 commits into from

Conversation

rluisr
Copy link

@rluisr rluisr commented Aug 3, 2019

Need PK each table on MySQL Group Replication.

2019-08-03T19:22:34.446530Z 80836 [ERROR] [MY-011542] [Repl] Plugin group_replication reported: 'Table migrations does not have any PRIMARY KEY. This is not compatible with Group Replication.'

Run drone and add id primary key, It’s worked.

.gitignore Outdated Show resolved Hide resolved
@@ -186,6 +186,7 @@ func selectCompleted(db *sql.DB) (map[string]struct{}, error) {

Choose a reason for hiding this comment

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

this file is automatically generated and should not be manually updated. Otherwise the next time we generate this file your changes will be lost. You need to send a pull request to update the generator, and then you need to regenerate this file using go generate

Copy link
Author

Choose a reason for hiding this comment

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

sorry I don't know the file where should I modify.

Copy link
Author

@rluisr rluisr Aug 4, 2019

Choose a reason for hiding this comment

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

@@ -186,6 +186,7 @@ func selectCompleted(db *sql.DB) (map[string]struct{}, error) {

var migrationTableCreate = `
CREATE TABLE IF NOT EXISTS migrations (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255)

Choose a reason for hiding this comment

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

If a primary key is required could we just remove the unique constraint from the name column, and use a primary key constraint instead?

CREATE TABLE IF NOT EXISTS migrations (
 name VARCHAR(255)
-,UNIQUE(name)
+,PRIMARY KEY(name)
)

Copy link
Author

Choose a reason for hiding this comment

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

yes. I think no need id if name is unique.

@@ -176,6 +176,7 @@ github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uP
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=

Choose a reason for hiding this comment

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

please exclude this file from the pull request

@rluisr
Copy link
Author

rluisr commented Aug 4, 2019

I recreate PR for excluding go.sum when this PR is merged.

@rluisr rluisr closed this Aug 4, 2019
@rluisr rluisr deleted the fix/migrations_pk branch August 6, 2019 13:45
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

3 participants