-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 primary key to schema_history #13611
Comments
Notes for anyone wanting to work on this:
|
I ran some tests with Percona XtraDB and noticed that adding the migration as suggested by @MasonM doesn’t fully address the issue. After the Adding the primary key directly in the Given these constraints, one possible solution is to introduce conditional logic immediately after the schema_history table creation. This logic would check whether the primary key exists and add it if it doesn’t – or safely handle any duplicate key errors if it already exists. While this approach isn’t perfectly elegant (as it requires running an extra query each time), it seems like a practical compromise for both new and existing installations. If this approach sounds acceptable, I’d be happy to submit a PR to implement it. |
@radusora Thanks for the details. That sounds reasonable. The query |
…ity through primary keys. Fixes argoproj#13611 Signed-off-by: Radu Sora <[email protected]>
…gh PKs. Fixes argoproj#13611 Signed-off-by: Radu Sora <[email protected]>
…gh PKs. Fixes argoproj#13611 Signed-off-by: Radu Sora <[email protected]>
@MasonM Thank you for the suggestion! I realized I needed to add an additional filter for the database, as the DB user in use could theoretically have access to other databases. Without the filter, the query against information_schema might return irrelevant results. Submitted the PR now. |
Summary
It would be good to have a primary key in the creation statement for the schema_history table.
Use Cases
DB replication mechanisms and integrity-checking mechanisms sometimes rely on the ability to identify a single row. Primary keys are made for this.
I bumped into this while using a percona-xtradb database deployed with the Percona Operator (which isn't too uncommon, I had it running in the cluster for another db already, so re-used it for the argo database), which will deny the creation of this table with the default configuration:
While it might feel like it adds no value to the argo-workflows project, this is a minor change, won't affect anything else, but will allow users to deploy argo easier. I might add a PR if this would be allowed.
The changes would go in migrate.go, where the creation would get a
primary key(schema_version)
and an additional migration line in the big set which would do an alter-add-primary-key statement to try and add the primary key to an already existing table.Message from the maintainers:
Love this feature request? Give it a 👍. We prioritise the proposals with the most 👍.
The text was updated successfully, but these errors were encountered: