Update 6.0.0 -> 6.1.0 issues errors: Immediate fix required or can it nevertheless be used?

Infos:

  • Used Zammad version: zammad-6.1.0-1695625218.7afd377e.centos7.x86_64
  • Used Zammad installation type: yum from repository
  • Operating system: CentOS Linux release 7.9.2009 (Core)
  • Browser + version: Firefox 117.0.1 (macOS)

Problem Description

Today’s yum update zammad printed out two errors, but in the end didn’t seem to (completely) fail. One error was during the database migration(?) step:

== 20230726082734 SMIMEMetaInformationTable: migrating ========================
-- change_table(:smime_certificates)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

The other later, apparently during node script/fix-node-modules.mjs:

$ node script/fix-node-modules.mjs
Done in 1.23s.
Building with Vite ⚡️
vite v4.4.9 building for production...
transforming...
✓ 1954 modules transformed.
[vite-plugin-pwa:build] "default" is not exported by "app/frontend/shared/composables/useImageViewer.ts", imported by "app/frontend/shared/components/Form/fields/FieldFile/FieldFileInput.vue?vue&type=script&setup=true&lang.ts".
file: /opt/zammad/app/frontend/shared/components/Form/fields/FieldFile/FieldFileInput.vue?vue&type=script&setup=true&lang.ts:24:7
22: import type { FormFieldContext } from '#shared/components/Form/types/field.ts'
23: import { MutationHandler } from '#shared/server/apollo/handler/index.ts'
24: import useImageViewer from '#shared/composables/useImageViewer.ts'
           ^
25: import { convertFileList } from '#shared/utils/files.ts'
26: import useConfirmation from '#mobile/components/CommonConfirmation/composable.ts'
error during build:
RollupError: "default" is not exported by "app/frontend/shared/composables/useImageViewer.ts", imported by "app/frontend/shared/components/Form/fields/FieldFile/FieldFileInput.vue?vue&type=script&setup=true&lang.ts".
    at error (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
    at Module.error (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13674:16)
    at Module.traceVariable (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:14104:29)
    at ModuleScope.findVariable (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:12547:39)
    at FunctionScope.findVariable (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at ChildScope.findVariable (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at Identifier.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:8267:40)
    at CallExpression.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at CallExpression.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:9833:15)
    at VariableDeclarator.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at VariableDeclaration.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5846:28)
    at BlockStatement.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5846:28)
    at FunctionExpression.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at Property.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at ObjectExpression.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5846:28)
    at CallExpression.bind (file:///opt/zammad/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:5846:28)

pid 3399 exit 1
Build with Vite failed! ❌

I don’t know if these errors are related and what their consequence is. Cen they be ignored (I guess not) and how can they be fixed?

The most important and urgent question is: Can we continue to work before possible fixes are applied or does Zammad has to stay closed for the time being?

The complete yum update output is very long. I have provided it here.

1 Like

As the error message says, the current and all following migrations are canceled, so there could be a lot of stuff missing.
So this should be checked/executed again.

About the failing assets precompile. Could you check what are the current files inside app/frontend/shared/components/Form/fields/FieldFile/ ?

Hi Dominik,

What is “this” and how can I execute it again? The process was run through a regular yum update zammad process.

In the meantime we have continued to work with Zammad, as it is an essential part of our operation. We haven’t encountered problems so far and we cannot risk to loose (more?) data.

We have the following content

$ tree -F app/frontend/shared/components/Form/fields/FieldFile/
app/frontend/shared/components/Form/fields/FieldFile/
├── graphql/
│   └── mutations/
│       └── uploadCache/
└── types.ts

3 directories, 1 file
$

app/frontend/shared/components/Form/fields/FieldFile/types.ts contains:

// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/

import type { StoredFile } from '#shared/graphql/types.ts'
import type { InputHTMLAttributes } from 'vue'

export interface FieldFileProps {
  accept?: InputHTMLAttributes['accept']
  capture?: InputHTMLAttributes['capture']
  multiple?: InputHTMLAttributes['multiple']
}

export type FileUploaded = Pick<StoredFile, 'name' | 'size' | 'type'> & {
  id?: Maybe<string>
  content?: string
  preview?: string
}

export interface FieldFileContext {
  uploadFiles(files: FileList | File[]): Promise<void>
}

Maybe all is fine, you could check in the rails console (rails c) if there are pending migrations with:

ActiveRecord::Migration.check_pending!

When this list is empty, all should be fine.

About the other problem, this seems to be fine already again.

@dominikklein I tried zammad run rails c ActiveRecord::Migration.check_pending and zammad run rails c config:get ActiveRecord::Migration.check_pending. Both returned

/opt/zammad/vendor/bundle/ruby/3.1.0/gems/thor-1.2.2/lib/thor/base.rb:525:in 'handle_argument_error': ERROR: "rails console" was called with arguments [...] (Thor::InvocationError)

and a call trace (which I can post if it is relevant). I assume this is the wrong syntax :slight_smile: Can you help out with the full command that is required to check ActiveRecord::Migration.check_pending?

You’re doing it wrong, @fthommen.

Please open up a Rails Console via zammad run rails c. After the Rails Console is ready to use, please submit following command: ActiveRecord::Migration.check_pending!

Post the output here, please. :slight_smile:

yes, I guessed so :grin:, but I just get an other error:

$ zammad run rails c                                            
Loading production environment (Rails 6.1.7.6)                                          
irb(main):001:0> ActiveRecord::Migration.check_pending
-- check_pending()
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:928:in `block in method_missing': undefined method `check_pending' for #<ActiveRecord::Migration:0x00007efd38829088 @name="ActiveRecord::Migration", @version=nil, @connection=nil> (NoMethodError)                                                     
irb(main):002:0> quit
$

@fliebe92 Oops, it seems the exclamation marks are part of the command?

$ zammad run rails c
Loading production environment (Rails 6.1.7.6)
irb(main):001:0> ActiveRecord::Migration.check_pending!
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:625:in `check_pending!':  (ActiveRecord::PendingMigrationError)

Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate RAILS_ENV=production

You have 11 pending migrations:

20230726082734_smime_meta_information_table.rb
20230728073916_smime_meta_information_data.rb
20230728090212_pgp_key_email_addresses.rb
20230801092655_issue_4543_organization_vip.rb
20230802112821_regex_operator_renaming.rb
20230807051414_input_fields_operator_renaming.rb
20230807171019_postmaster_filter_regex_operator.rb
20230817130057_update_api_password_access_frontend.rb
20230823082823_update_format_settings.rb
20230825101042_show_package_url.rb
20230825150332_issue_4657_time_accounting_selector.rb


irb(main):002:0> quit
$

would these instructions translate to “run zammad run rails db:migrate RAILS_ENV=production”? (I rather ask before breaking somethin…)

Hi,
i had the same migration error on debian, but i thought the error on my selfmade migration of mysql to postgres a few years ago.

in my case was the problem in 20230726082734_smime_meta_information_table.rb
It describes to remove the index “subject”.
The named index “subject” was not present in my postgrsql tablestructure.

So i removed the following migration definition and rerun the migration.

I checked the database after migration with adminer (https://www.adminer.org/) and everything looks good.

Mayby you run in the same problem.
zammad-mig-problem

at this time, it seams that no one else had this problem and so i didnt create a issue-ticket.

Thanks @datenschuft . Our situation is similar (migrated from MySQL to PostgreSQL a while ago). However even after commenting out the mentioned line in /opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb, zammad run rails db:migrate RAILS_ENV=production fails with a long trace:

$ zammad run rails db:migrate RAILS_ENV=production
== 20230726082734 SMIMEMetaInformationTable: migrating ========================
-- change_table(:smime_certificates)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

No indexes found on smime_certificates with the options provided.
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:1411:in `index_name_for_remove'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:470:in `remove_index'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_definitions.rb:711:in `remove_index'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:24:in `remove_columns'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:15:in `block in migrate_table'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:490:in `change_table'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:929:in `block in method_missing'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:897:in `block in say_with_time'
/opt/zammad/vendor/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:296:in `measure'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:897:in `say_with_time'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:918:in `method_missing'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:14:in `migrate_table'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:8:in `change'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:867:in `exec_migration'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/opt/zammad/vendor/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:296:in `measure'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:850:in `block in migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:849:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1037:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:209:in `transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `ddl_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:in `block in migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1086:in `up'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1061:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/command.rb:50:in `invoke'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands.rb:18:in `<main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/zammad/bin/rails:5:in `<main>'

Caused by:
ArgumentError: No indexes found on smime_certificates with the options provided.
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:1411:in `index_name_for_remove'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql/schema_statements.rb:470:in `remove_index'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_definitions.rb:711:in `remove_index'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:24:in `remove_columns'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:15:in `block in migrate_table'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:490:in `change_table'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:929:in `block in method_missing'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:897:in `block in say_with_time'
/opt/zammad/vendor/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:296:in `measure'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:897:in `say_with_time'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:918:in `method_missing'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:14:in `migrate_table'
/opt/zammad/db/migrate/20230726082734_smime_meta_information_table.rb:8:in `change'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:867:in `exec_migration'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/opt/zammad/vendor/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:296:in `measure'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:850:in `block in migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:849:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1037:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:209:in `transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `ddl_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:in `block in migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1251:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1086:in `up'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1061:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/command.rb:50:in `invoke'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.6/lib/rails/commands.rb:18:in `<main>'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/zammad/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/opt/zammad/bin/rails:5:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
$

And the listed migrations are still pending.

To make it worse, since a recent upgrade to the latest 6.1.0-1701845240.5a81e629.centos7 (yum upgrade zammad), our triggers have stopped working :frowning:. So any hint on how to fix this unfortunate situation are highly appreciated.

Hi @fthommen. How does your db/migrate/20230726082734_smime_meta_information_table.rb look like? Sounds strange.

hi @fliebe92 It’s

# Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/

class SMIMEMetaInformationTable < ActiveRecord::Migration[6.1]
  def change
    # return if it's a new setup
    return if !Setting.exists?(name: 'system_init_done')

    migrate_table
  end

  private

  def migrate_table
    change_table :smime_certificates do |t|
      remove_columns(t)
      rename_columns(t)
      add_columns(t)
    end

    SMIMECertificate.reset_column_information
  end

  def remove_columns(t)
    t.remove_index :modulus
#    t.remove_index :subject

    t.remove :subject, :doc_hash, :not_before_at, :not_after_at
  end

  def rename_columns(t)
    t.rename :modulus, :uid
    t.rename :raw, :pem
  end

  def add_columns(t)
    if Rails.application.config.db_column_array
      t.column :email_addresses, :string, null: true, array: true
    else
      t.column :email_addresses, :json, null: true
    end

    t.string :issuer_hash,  limit: 128, null: true
    t.string :subject_hash, limit: 128, null: true

    t.index [:uid]
  end
end

The commented out t.remove_index :subject is from me from a suggestion earlier in this thread

Hi @fthommen. I guess your database table is missing the other index modulus as well.

Thanks @fliebe92:thinking: and how can this be fixed?

…can it be fixed at all?

Well, your database is not correct I would say, no idea why. When you already commented one index in the aforementioned file, why not comment the other one as well and give it a try? But just to mention, this is like a hack, no guarantee that it will work or that your instance is functional afterward. Make a backup etc.

I understand that, but of course I’d rather understand (or know), what the problem is and fix it properly. Sooner or later, hacks will “fall on your feet”. I wonder if a complete reinstallation and restore of a backup would fix the issue or if it would recreate the exact same problem

I guess it’s worth a try, as far as the restore does NOT restore the database structure. Not sure though.

The problem with backup and restore is that if the original database contains faulty data / indexes / missing stuff, then it will be migrated 1 by 1 to the new system. It’s a full database dump and a restore of said dump. Nothing that looks up the migrations etc.

Thanks for the clarification @MrGeneration :thinking: since backup and restore don’t seem to be a good solution, are there other ways to (safely) try, when manual and automated migrations fail? Since we now have functional deficits, this has become quite an issue for us.