If you want to make it easier in the future -- you can install the "django-extensions" package which enables the "resetdb" command, which will drop everything properly, whereas the django builtin one does trip up sometimes.
On Fri, Oct 30, 2020 at 9:00 PM Grant Gainey <[email protected]> wrote: > > > On Fri, Oct 30, 2020 at 8:31 PM Bin Li (BLOOMBERG/ 120 PARK) < > [email protected]> wrote: > >> Hi, >> I am testing 3.7.3 release with external postgres db. I want to reset the >> database first. After I drop all database tables and got the following >> errors when I run "django-admin migrate --noinput" >> Please advice. >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py", >> line 82, in _execute >> return self.cursor.execute(sql) >> psycopg2.errors.DuplicateObject: type "pulp_evr_array_item" already exists >> > > pulp_evr_array_item is a database *type*, installed/created > by pulp_rpm/app/migrations/0013_RAW_rpm_evr_extension.py. If you're > dropping all the tables and running the migrations, you'll also want to > > DROP TYPE pulp_evr_array_item; > DROP TYPE pulp_evr_t; > > See if that helps! > > G > >> >> >> The above exception was the direct cause of the following exception: >> >> Traceback (most recent call last): >> File "/opt/utils/venv/pulp/3.7.3/bin/django-admin", line 8, in <module> >> sys.exit(execute_from_command_line()) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py", >> line 381, in execute_from_command_line >> utility.execute() >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py", >> line 375, in execute >> self.fetch_command(subcommand).run_from_argv(self.argv) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/base.py", >> line 323, in run_from_argv >> self.execute(*args, **cmd_options) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/base.py", >> line 364, in execute >> output = self.handle(*args, **options) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/base.py", >> line 83, in wrapped >> res = handle_func(*args, **kwargs) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py", >> line 234, in handle >> fake_initial=fake_initial, >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/executor.py", >> line 117, in migrate >> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, >> fake_initial=fake_initial) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/executor.py", >> line 147, in _migrate_all_forwards >> state = self.apply_migration(state, migration, fake=fake, >> fake_initial=fake_initial) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/executor.py", >> line 245, in apply_migration >> state = migration.apply(state, schema_editor) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/migration.py", >> line 124, in apply >> operation.database_forwards(self.app_label, schema_editor, old_state, >> project_state) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/special.py", >> line 105, in database_forwards >> self._run_sql(schema_editor, self.sql) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/special.py", >> line 130, in _run_sql >> schema_editor.execute(statement, params=None) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/base/schema.py", >> line 137, in execute >> cursor.execute(sql, params) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py", >> line 67, in execute >> return self._execute_with_wrappers(sql, params, many=False, >> executor=self._execute) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py", >> line 76, in _execute_with_wrappers >> return executor(sql, params, many, context) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py", >> line 84, in _execute >> return self.cursor.execute(sql, params) >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/utils.py", >> line 89, in __exit__ >> raise dj_exc_value.with_traceback(traceback) from exc_value >> File >> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py", >> line 82, in _execute >> return self.cursor.execute(sql) >> django.db.utils.ProgrammingError: type "pulp_evr_array_item" already >> exists >> >> >> I am running >> { >> "versions": [ >> { >> "component": "pulpcore", >> "version": "3.7.3" >> }, >> { >> "component": "pulp_rpm", >> "version": "3.7.0" >> }, >> { >> "component": "pulp_file", >> "version": "1.3.0" >> } >> >> >> _______________________________________________ >> Pulp-list mailing list >> [email protected] >> https://www.redhat.com/mailman/listinfo/pulp-list > > > > -- > Grant Gainey > Principal Software Engineer, Red Hat System Management Engineering > _______________________________________________ > Pulp-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/pulp-list
_______________________________________________ Pulp-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/pulp-list
