ansible / galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Apache License 2.0
855 stars 329 forks source link

migrate errors 'IntegrityError: could not create unique index "main_repositoryversion_name_repository_id_2740ab2b_uniq"' #530

Closed alikins closed 6 years ago

alikins commented 6 years ago

Using release/3.0 at 8e5f23ffdafc5a2b158ba4e999f1ba0c879ff172 that was previously running bc34ce1ff23fec5ab868817ffb15298f9675fc24 I get db migration issues when running 'make dev/up_tmux'

The error short blurb:

galaxy_1    | django.db.utils.IntegrityError: could not create unique index "main_repositoryversion_name_repository_id_2740ab2b_uniq"
galaxy_1    | DETAIL:  Key (name, repository_id)=(0.0.1, 3) is duplicated.
galaxy_1    | make: *** [migrate] Error 1
galaxy_1    |   Applying main.0095_repository_version_unique...galaxy_galaxy_1 exited with code 2

make dev/logf log and traceback

galaxy_1    | + make waitenv
galaxy_1    | Waiting for services to start...
galaxy_1    | python ./manage.py waitenv
galaxy_1    | 2018-05-14 12:20:30,355 INFO waitenv: manage.py waitenv...
galaxy_1    | 2018-05-14 12:20:30,355 INFO waitenv: Waiting on postgres:5432
galaxy_1    | 2018-05-14 12:20:30,356 INFO waitenv: Waiting on rabbitmq:5672
galaxy_1    | 2018-05-14 12:20:36,359 INFO waitenv: Waiting on memcache:11211
galaxy_1    | + make build/static
galaxy_1    | cd galaxyui; yarn install
galaxy_1    | yarn install v1.5.1
galaxy_1    | [1/4] Resolving packages...
galaxy_1    | success Already up-to-date.
galaxy_1    | Done in 0.67s.
galaxy_1    | cd galaxyui; ng build --prod
galaxy_1    | Your global Angular CLI version (1.7.4) is greater than your local
galaxy_1    | version (1.7.0). The local Angular CLI version is used.
galaxy_1    | To disable this warning use "ng set --global warnings.versionMismatch=false".
galaxy_1    | Date: 2018-05-14T16:21:55.730Z
galaxy_1    | Hash: 1bd888eb0035a38ce8b0
galaxy_1    | Time: 76484ms
galaxy_1    | chunk {0} main.3d9faf5da62a1c8943e0.bundle.js (main) 1.83 MB [initial] [rendered]
galaxy_1    | chunk {1} polyfills.16286cde992a53adbc8d.bundle.js (polyfills) 59.4 kB [initial] [rendered]
galaxy_1    | chunk {2} styles.d543255c1c9375bc04dc.bundle.css (styles) 427 kB [initial] [rendered]
galaxy_1    | chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]
galaxy_1    | rm -rf galaxyui/node_modules
galaxy_1    | + cd /galaxy/galaxyui
galaxy_1    | + yarn install
galaxy_1    | yarn install v1.5.1
galaxy_1    | [1/4] Resolving packages...
galaxy_1    | [2/4] Fetching packages...
galaxy_1    | info fsevents@1.1.3: The platform "linux" is incompatible with this module.
galaxy_1    | info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
galaxy_1    | [3/4] Linking dependencies...
galaxy_1    | [4/4] Building fresh packages...
galaxy_1    | Done in 7.46s.
galaxy_1    | + cd /galaxy
galaxy_1    | + '[' '' '!=' 1 ']'
galaxy_1    | + make migrate
galaxy_1    | Run migrations
galaxy_1    | python ./manage.py migrate --noinput
galaxy_1    | Operations to perform:
galaxy_1    |   Apply all migrations: account, accounts, admin, auth, authtoken, contenttypes, djcelery, main, sessions, sites, socialaccount
galaxy_1    | Running migrations:
galaxy_1    | Traceback (most recent call last):
galaxy_1    |   File "./manage.py", line 22, in <module>
galaxy_1    |     manage()
galaxy_1    |   File "/galaxy/galaxy/__init__.py", line 64, in manage
galaxy_1    |     execute_from_command_line(sys.argv)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
galaxy_1    |     utility.execute()
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
galaxy_1    |     self.fetch_command(subcommand).run_from_argv(self.argv)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
galaxy_1    |     self.execute(*args, **cmd_options)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
galaxy_1    |     output = self.handle(*args, **options)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
galaxy_1    |     fake_initial=fake_initial,
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
galaxy_1    |     state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
galaxy_1    |     state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
galaxy_1    |     state = migration.apply(state, schema_editor)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
galaxy_1    |     operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 536, in database_forwards
galaxy_1    |     getattr(new_model._meta, self.option_name, set()),
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 369, in alter_unique_together
galaxy_1    |     self.execute(self._create_unique_sql(model, columns))
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 136, in execute
galaxy_1    |     cursor.execute(sql, params)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
galaxy_1    |     return super(CursorDebugWrapper, self).execute(sql, params)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
galaxy_1    |     return self.cursor.execute(sql, params)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
galaxy_1    |     six.reraise(dj_exc_type, dj_exc_value, traceback)
galaxy_1    |   File "/var/lib/galaxy/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
galaxy_1    |     return self.cursor.execute(sql, params)
galaxy_1    | django.db.utils.IntegrityError: could not create unique index "main_repositoryversion_name_repository_id_2740ab2b_uniq"
galaxy_1    | DETAIL:  Key (name, repository_id)=(0.0.1, 3) is duplicated.
galaxy_1    | make: *** [migrate] Error 1
galaxy_1    |   Applying main.0095_repository_version_unique...galaxy_galaxy_1 exited with code 2
alikins commented 6 years ago

assuming I may need to do some manual data cleaning to get this migratation to apply...

chouseknecht commented 6 years ago

I think this was fixed by #534. It's working fine when applying migrations to a copy of production.