PG::UndefinedTable: ERROR: relation "billing.invoice_documents_id_seq" does not exist

Hello all I am new here. I am trying to install yeti switch in my VPS and I have an error when I try to make the Databases data initialization(initialize empty databases during initial installation)

With order:

su -s /bin/bash yeti-web -c “RAILS_ENV=production ./bin/bundle.sh exec rake db:seed” I have the following error:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation “billing.invoice_documents_id_seq” does not exist (ActiveRecord::StatementInvalid)
LINE 59: SELECT pg_catalog.setval(‘billing.invoice_documents_id_seq’,…

root@vm:/opt/yeti-web# su -s /bin/bash yeti-web -c "RAILS_ENV=production ./bin/bundle.sh exec rake db:schema:load db:migrate"
2026-01-23 20:55:43.904905 W [28813:27160] Rails -- config/policy_roles.yml config is missing. Default rule is disallow.
App Timezone Europe/Berlin
Yeti DB timezone UTC
CDR DB timezone UTC
ActiveRecord timezone utc
root@vmi2893215:/opt/yeti-web# su -s /bin/bash yeti-web -c "RAILS_ENV=production ./bin/bundle.sh exec rake db:seed"
2026-01-23 20:56:18.928935 W [28859:27160] Rails -- config/policy_roles.yml config is missing. Default rule is disallow.
App Timezone Europe/Berlin
Yeti DB timezone UTC
CDR DB timezone UTC
ActiveRecord timezone utc
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "billing.invoice_documents_id_seq" does not exist (ActiveRecord::StatementInvalid)
LINE 59: SELECT pg_catalog.setval('billing.invoice_documents_id_seq',...
                                  ^
2026-01-23 20:56:21.883058 I [28859:worker-1] Rails -- sentry -- [Transport] Sending envelope with items [event] cc06c3808b5c4be893f54693456c057f to Sentry
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:56:in `exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:56:in `block (2 levels) in raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1004:in `block in with_raw_connection'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:976:in `with_raw_connection'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `block in raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1119:in `log'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:54:in `raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:538:in `internal_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `execute'
/opt/yeti-web/db/seeds.rb:10:in `execute_sql_file'
/opt/yeti-web/db/seeds.rb:37:in `block in <main>'
/opt/yeti-web/db/seeds.rb:36:in `each'
/opt/yeti-web/db/seeds.rb:36:in `<main>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:562:in `block in load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:77:in `block in wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:74:in `wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:648:in `block (2 levels) in <class:Engine>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:141:in `run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:562:in `load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/tasks/database_tasks.rb:500:in `load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/railties/databases.rake:405:in `block (2 levels) in <main>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.12.0/lib/sentry/rake.rb:26:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `kernel_load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:23:in `run'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:452:in `exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:35:in `dispatch'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:29:in `start'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundle:28:in `block in <top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundle:20:in `<top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundler:4:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundler:4:in `<top (required)>'
./vendor/bundler/bin/bundler:25:in `load'
./vendor/bundler/bin/bundler:25:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "billing.invoice_documents_id_seq" does not exist (PG::UndefinedTable)
LINE 59: SELECT pg_catalog.setval('billing.invoice_documents_id_seq',...
                                  ^
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:56:in `exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:56:in `block (2 levels) in raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1004:in `block in with_raw_connection'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:976:in `with_raw_connection'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `block in raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:1119:in `log'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:54:in `raw_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:538:in `internal_execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:137:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `execute'
/opt/yeti-web/db/seeds.rb:10:in `execute_sql_file'
/opt/yeti-web/db/seeds.rb:37:in `block in <main>'
/opt/yeti-web/db/seeds.rb:36:in `each'
/opt/yeti-web/db/seeds.rb:36:in `<main>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:562:in `block in load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:77:in `block in wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:74:in `wrap'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:648:in `block (2 levels) in <class:Engine>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:141:in `run_callbacks'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/engine.rb:562:in `load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/tasks/database_tasks.rb:500:in `load_seed'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/railties/databases.rake:405:in `block (2 levels) in <main>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/sentry-ruby-5.12.0/lib/sentry/rake.rb:26:in `execute'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:59:in `kernel_load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli/exec.rb:23:in `run'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:452:in `exec'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:35:in `dispatch'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/cli.rb:29:in `start'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundle:28:in `block in <top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundle:20:in `<top (required)>'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundler:4:in `load'
/opt/yeti-web/vendor/bundle/ruby/3.3.0/gems/bundler-2.6.3/exe/bundler:4:in `<top (required)>'
./vendor/bundler/bin/bundler:25:in `load'
./vendor/bundler/bin/bundler:25:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

Someone with similar issue

looks like incorrect configuration in database.yml.

I AM triying then instalation in a bash script. When i check the instalation in manual mode (copy and paste from documentation) Databases data initialization working fine.

I am checking the script discard any inconvenient

I check database.yml and it is ok. I this scenario i am changed the default name for CDR and yeti dstabases.

So this issue is not related to yeti, this is just some script bugs on your side.

before the error INE 59: SELECT pg_catalog.setval(‘billing.invoice_documents_id_seq’,… I had to create the pgq manually after database creation to advance in the configuration after the error posted in this post

I what moment pgq schema would be created?

I what moment pgq schema would be created?

You shouldn’t create anything manually. Follow documentation please. If you see any error during installation, it means system will not work properly.

Hello I make some fix in my script to solve the error named above:

  1. Make a correct update and upgrade in the OS after Repositories configuration
    apt-get install -y linux-image-amd64
    apt install -y linux-headers-amd64
    apt full-upgrade -y
    apt autoremove -y
  2. Reboot system
    reboot
  3. Copy policy_roles.yml.distr and give grant to all files modified
    cp /opt/yeti-web/config/policy_roles.yml.distr /opt/yeti-web/config/policy_roles.yml
    chown -R yeti-web:yeti-web /opt/yeti-web

These steps definitely not solving any errors mentioned in this topic.