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

Unique indexes are named different after the conversion #4

Closed
jacobvosmaer opened this issue May 8, 2015 · 1 comment · Fixed by #5
Closed

Unique indexes are named different after the conversion #4

jacobvosmaer opened this issue May 8, 2015 · 1 comment · Fixed by #5
Assignees

Comments

@jacobvosmaer
Copy link

On a fresh 7.10 PG GitLab installation, the index on users are:

Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
    "index_users_on_authentication_token" UNIQUE, btree (authentication_token)
    "index_users_on_confirmation_token" UNIQUE, btree (confirmation_token)
    "index_users_on_email" UNIQUE, btree (email)
    "index_users_on_reset_password_token" UNIQUE, btree (reset_password_token)
    "index_users_on_admin" btree (admin)
    "index_users_on_created_at_and_id" btree (created_at, id)
    "index_users_on_current_sign_in_at" btree (current_sign_in_at)
    "index_users_on_name" btree (name)
    "index_users_on_username" btree (username)

On a 'converted' PG they are:

Indexes:
    "users_pkey" PRIMARY KEY, btree (id)
    "users_authentication_token_key" UNIQUE CONSTRAINT, btree (authentication_token)
    "users_confirmation_token_key" UNIQUE CONSTRAINT, btree (confirmation_token)
    "users_email_key" UNIQUE CONSTRAINT, btree (email)
    "users_reset_password_token_key" UNIQUE CONSTRAINT, btree (reset_password_token)
    "index_users_on_admin" btree (admin)
    "index_users_on_created_at_and_id" btree (created_at, id)
    "index_users_on_current_sign_in_at" btree (current_sign_in_at)
    "index_users_on_name" btree (name)
    "index_users_on_username" btree (username)

I don't know the difference between UNIQUE CONSTRAINT and UNIQUE. The index names are definitely different.

cc @DouweM

@DouweM
Copy link

DouweM commented May 8, 2015

Looks like add_index_statements.rb is setting the correct name, but it's skipping unique indexes that have already been added by db_converter.py which apparently doesn't respect those names. I'll have a look tomorrow.

UNIQUE and UNIQUE CONSTRAINT are a potato/potato thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants