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
set annotation_id as primary key in annotation_tag table #12970
Conversation
Joshua Thornton seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Seeing I'm getting a failure in test:
And in Postgres integration:
Not being familiar with all the uses of the database here I'm not exactly sure where concentrate next. Could I get some direction? |
annotation_id and tag_id probably needs to be primary key. Not sure if that's supported by Grafana migrator. Not sure this change will be allowed for existing annotation_tag tables which could be the next potential problem. |
Yea, this won’t work, need a new column if a primary key is needed |
If I setup an ID field with autoincrement is that they way to go? |
yes |
We still need a migration path for that change though I suppose. Basically rename table, create new table, migrate data and drop old table - think that's how we usually do it and it should be examples of that among our migration code. |
Creating a new table and migrating data won't help if still try to create the table without PK first. In this case, I think we need to both modify the current migration (won't run if it's already present) and create rename/copy data into a new table with PK to get full consistency. here is an example of how to create create a new table and migrate the old data https://github.com/grafana/grafana/blob/master/pkg/services/sqlstore/migrations/dashboard_mig.go#L208 |
Closing this as it needs new id column |
I'm facing this same issue while using MariaDB, fresh install using docker. Grafana v6.0.1 and 6.0.2. Is there are work around?
|
This corrects a failure to migrate/create the annotation_tag table on MariaDB with
innodb_force_primary_key=1
which is required for Galera clustering.setting annotation_id as primary key in table to satisfy innodb_force_primary_key=1
Related to #12971