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

tootcli fix-duplicates bugs #19133

Closed
shleeable opened this issue Sep 7, 2022 · 3 comments · Fixed by #20502
Closed

tootcli fix-duplicates bugs #19133

shleeable opened this issue Sep 7, 2022 · 3 comments · Fixed by #20502
Labels
bug Something isn't working

Comments

@shleeable
Copy link
Contributor

shleeable commented Sep 7, 2022

Steps to reproduce the problem

Running the current fix-duplicates toolcli adds the index_tags_on_name_lower index back, even after the mitgrate has removed it.

ActiveRecord::Base.connection.add_index :tags, 'lower((name)::text)', name: 'index_tags_on_name_lower', unique: true

https://github.com/mastodon/mastodon/blob/main/db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb

Expected behaviour

index should be removed

Actual behaviour

index is recreated.

Specifications

main

@shleeable shleeable added the bug Something isn't working label Sep 7, 2022
@shleeable
Copy link
Contributor Author

shleeable commented Sep 7, 2022

Similar issue with index_users_on_remember_token might be n

ERROR:  index "index_users_on_remember_token" does not exist
STATEMENT:  DROP INDEX  "index_users_on_remember_token"

ActiveRecord::Base.connection.add_index :users, ['remember_token'], name: 'index_users_on_remember_token', unique: true if ActiveRecord::Migrator.current_version < 20220118183010

Was this deleted here?

https://github.com/mastodon/mastodon/blob/main/db/post_migrate/20220118183123_remove_rememberable_from_users.rb

@shleeable
Copy link
Contributor Author

for @ClearlyClaire

@ClearlyClaire
Copy link
Contributor

Running the current fix-duplicates toolcli adds the index_tags_on_name_lower index back, even after the mitgrate has removed it.

ActiveRecord::Base.connection.add_index :tags, 'lower((name)::text)', name: 'index_tags_on_name_lower', unique: true

https://github.com/mastodon/mastodon/blob/main/db/migrate/20210421121431_add_case_insensitive_btree_index_to_tags.rb

Oops, re-inserting it should have been conditional indeed.

Similar issue with index_users_on_remember_token might be n

ERROR:  index "index_users_on_remember_token" does not exist
STATEMENT:  DROP INDEX  "index_users_on_remember_token"

This is not an error when adding an index, but when attempting to remove it. However, the script should not error out if the index doesn't exist. Can I get more context for this error?

ActiveRecord::Base.connection.add_index :users, ['remember_token'], name: 'index_users_on_remember_token', unique: true if ActiveRecord::Migrator.current_version < 20220118183010

Was this deleted here?

https://github.com/mastodon/mastodon/blob/main/db/post_migrate/20220118183123_remove_rememberable_from_users.rb

No, it's deleted in https://github.com/mastodon/mastodon/blob/main/db/post_migrate/20220118183010_remove_index_users_on_remember_token.rb

ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this issue Nov 12, 2022
Gargron pushed a commit that referenced this issue Nov 13, 2022
kadoshita pushed a commit to kadoshita/mastodon that referenced this issue Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants