Hey folks, I recently tried to rebuild my Discourse container after the web UI update functionality failed, and ran into this error:
Undeclared attribute type for enum 'sync_type'. Enums must be backed by a database column or declared with an explicit type via `attribute`.
Full output around that error below:
I, [2024-09-16T15:58:43.855180 #1] INFO -- : > exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
I, [2024-09-16T15:58:43.857371 #1] INFO -- : > sleep 10
1608:C 16 Sep 2024 15:58:43.867 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1608:C 16 Sep 2024 15:58:43.867 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=1608, just started
1608:C 16 Sep 2024 15:58:43.868 # Configuration loaded
1608:M 16 Sep 2024 15:58:43.868 * monotonic clock: POSIX clock_gettime
1608:M 16 Sep 2024 15:58:43.869 # Warning: Could not create server TCP listening socket *:6379: bind: Address already in use
1608:M 16 Sep 2024 15:58:43.869 # Failed listening on port 6379 (TCP), aborting.
I, [2024-09-16T15:58:53.860226 #1] INFO -- :
I, [2024-09-16T15:58:53.860714 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
Undeclared attribute type for enum 'sync_type'. Enums must be backed by a database column or declared with an explicit type via `attribute`.
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/enum.rb:250:in `block in _enum'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:225:in `block in attribute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:266:in `block in load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:265:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:265:in `load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:567:in `block in load_schema'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:564:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:564:in `load_schema'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:445:in `attribute_types'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `block in _load_from_sql'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `reject'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `_load_from_sql'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:1020:in `instantiate_records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:975:in `block in exec_queries'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:1028:in `skip_query_cache_if_necessary'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:966:in `exec_queries'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:752:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:264:in `records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation/delegation.rb:100:in `each'
/var/www/discourse/plugins/discourse-events/db/migrate/20240815072133_move_source_datetimes_to_filters.rb:5:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:970:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:969:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:227:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:968:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1178:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1529:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1580:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1528:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1600:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1274:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1249:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/tasks/database_tasks.rb:251:in `migrate'
/var/www/discourse/lib/tasks/db.rake:259:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:234:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Caused by:
Undeclared attribute type for enum 'sync_type'. Enums must be backed by a database column or declared with an explicit type via `attribute`.
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/enum.rb:250:in `block in _enum'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:225:in `block in attribute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:266:in `block in load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:265:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/attributes.rb:265:in `load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:567:in `block in load_schema'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:564:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:564:in `load_schema'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/model_schema.rb:445:in `attribute_types'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `block in _load_from_sql'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `reject'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/querying.rb:69:in `_load_from_sql'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:1020:in `instantiate_records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:975:in `block in exec_queries'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:1028:in `skip_query_cache_if_necessary'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:966:in `exec_queries'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:752:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation.rb:264:in `records'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/relation/delegation.rb:100:in `each'
/var/www/discourse/plugins/discourse-events/db/migrate/20240815072133_move_source_datetimes_to_filters.rb:5:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:970:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:969:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:227:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:968:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1178:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1529:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1580:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1528:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1600:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1274:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1249:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/tasks/database_tasks.rb:251:in `migrate'
/var/www/discourse/lib/tasks/db.rake:259:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:234:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I tried disabling all of the plugin installs before attempting that the rebuild and this error persists.