invenio-app-ils
invenio-app-ils copied to clipboard
Dependency on DB tables
Package version (if known): v1.0.0a21
Describe the bug
On the attempt of recreating the db:
psycopg2.errors.DependentObjectsStillExist: cannot drop table files_bucket because other objects depend on it
DETAIL: constraint fk_records_buckets_bucket_id_files_bucket on table records_buckets depends on table files_bucket
HINT: Use DROP ... CASCADE to drop the dependent objects too.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/bin/invenio", line 8, in <module>
sys.exit(cli())
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/flask/cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 1289, in invoke
rv.append(sub_ctx.command.invoke(sub_ctx))
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/flask/cli.py", line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/invenio_db/cli.py", line 74, in drop
table.drop(bind=_db.engine, checkfirst=True)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/sql/schema.py", line 939, in drop
bind._run_visitor(ddl.SchemaDropper, self, checkfirst=checkfirst)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 2095, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1656, in _run_visitor
visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/sql/visitors.py", line 145, in traverse_single
return meth(obj, **kw)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 1009, in visit_table
self.connection.execute(DropTable(table))
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
return meth(self, multiparams, params)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1073, in _execute_ddl
compiled,
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1317, in _execute_context
e, statement, parameters, cursor, context
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1511, in _handle_dbapi_exception
sqlalchemy_exception, with_traceback=exc_info[2], from_=e
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
cursor, statement, parameters, context
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.InternalError: (psycopg2.errors.DependentObjectsStillExist) cannot drop table files_bucket because other objects depend on it
DETAIL: constraint fk_records_buckets_bucket_id_files_bucket on table records_buckets depends on table files_bucket
HINT: Use DROP ... CASCADE to drop the dependent objects too.