Upgrading to 2025-01-15 ERROR: relation "c4db_version" does not exist

23 views
Skip to first unread message

Justin Hannah

unread,
Jan 16, 2025, 1:34:50 AMJan 16
to dnl-class4-user
Upgraded RPMs to 2025-01-15, getting this error,  can someone provide the correct database migration path or script to fix it?


2025-01-16 06:30:12  [NOTICE] src/utils/dnl_log.c:226 The log module exit...
2025-01-16 06:30:13  [NOTICE] src/utils/dnl_log.c:413 Changed log level to [DEBUG]
2025-01-16 06:30:13  [INFO] src/main/main.c:212 DNL WebHelper 7.4.4-1 (master/9520a0a5712);Build date: 2025-01-06;Debug symbols: enabled
2025-01-16 06:30:13  [INFO] src/main/main.c:213 DB version: 1fefdfbda2daeb6e62d69b5e024fad9a
2025-01-16 06:30:13  [INFO] src/main/main.c:216 Reading configuration
2025-01-16 06:30:13  [INFO] src/main/dnl_core.c:326 Our IP address '207.174.124.11'
2025-01-16 06:30:13  [CRITICAL] src/main/main.c:232 DB version check failed: Failed to get version - ERROR:  relation "c4db_version" does not exist
LINE 1: SELECT version_num, tag FROM c4db_version LIMIT 1
                                     ^
!
2025-01-16 06:30:13  [NOTICE] src/utils/dnl_log.c:226 The log module exit...

Pradeep Patidar

unread,
Jan 16, 2025, 9:37:38 AMJan 16
to dnl-class4-user
Hello.
upgrade db should be cd /opt/denovo_v6/api_dnl , alembic -c alembic.ini upgrade heads

It should work after the DB update



Justin Hannah

unread,
Jan 16, 2025, 4:55:26 PMJan 16
to dnl-class4-user
how do i make alembic ignore things that already were done:   psycopg2.errors.DuplicateColumn: column "shaken_force_validation" of relation "resource" already exists
do i need to install the package https://repo.denovolab.com/rocky/8/noarch/dnl-database-1.01-20250109.el8.noarch.rpm  ?  i didn't do it becuase i wasnt sure if it would clobber my existing install


[root@sw api_dnl]# /usr/local/bin/alembic -c alembic.ini upgrade heads
/usr/local/lib/python3.6/site-packages/jwt/utils.py:8: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.primitives.asymmetric.utils import (
postgresql://webbackend:nopasswd@localhost:5432/class4_dnl
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 9bc65b0ffea8 -> 79fe4181f801, new schema changes
Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.DuplicateColumn: column "shaken_force_validation" of relation "resource" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/alembic", line 33, in <module>
    sys.exit(load_entry_point('alembic==0.9.1', 'console_scripts', 'alembic')())
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 479, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 473, in main
    self.run_cmd(cfg, options)
  File "/usr/local/lib/python3.6/site-packages/alembic/config.py", line 456, in run_cmd
    **dict((k, getattr(options, k, None)) for k in kwarg)
  File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line 254, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", line 416, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", line 64, in load_module_py
    module_id, path).load_module(module_id)
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/env.py", line 94, in <module>
    run_migrations_online()
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/env.py", line 89, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", line 817, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 323, in run_migrations
    step.migration_fn(**kw)
  File "/usr/lib/python3.6/site-packages/api_dnl/migrations/versions/79fe4181f801_new_schema_changes.py", line 29, in upgrade
    op.add_column('resource', sa.Column('shaken_force_validation', sa.Boolean()))
  File "<string>", line 8, in add_column
  File "<string>", line 3, in add_column
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/ops.py", line 1551, in add_column
    return operations.invoke(op)
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/base.py", line 318, in invoke
    return fn(self, operation)
  File "/usr/local/lib/python3.6/site-packages/alembic/operations/toimpl.py", line 123, in add_column
    schema=schema
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 172, in add_column
    self._exec(base.AddColumn(table_name, column, schema=schema))
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 118, in _exec
    return conn.execute(construct, multiparams, *params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1002, in _execute_ddl
    compiled
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateColumn) column "shaken_force_validation" of relation "resource" already exists
 [SQL: 'ALTER TABLE resource ADD COLUMN shaken_force_validation BOOLEAN']
[root@sw api_dnl]#
Reply all
Reply to author
Forward
0 new messages