Problem:
Want to migrate my database from mariadb to postgres. I am following the steps provided in the manual: Section: Switching from SQLite to MySQL/PostgreSQL while maintaining existing data.
The migration fails at step: (move the data to the new db)
bundle exec rake db:convert:prod2dev
Expected outcome:
Migration succeeds.
Foreman and Proxy versions:
1.19.1
Foreman and Proxy plugin versions:
foreman_memcache 0.1.1
foreman_templates 6.0.3
puppetdb_foreman 4.0.0
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
[root@foreman]sh> foreman-rake db:convert:prod2dev
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
Converting ar_internal_metadata...1 records converted in 0.47762999683618546 seconds
Converting architectures...4 records converted in 0.10056199878454208 seconds
Converting architectures_operatingsystems...45 records converted in 0.1366613507270813 seconds
Converting audits...1732842 records converted in 5631.201423153281 seconds
Converting auth_sources...3 records converted in 1.0005889981985092 seconds
Converting bookmarks...6 records converted in 0.49473225325345993 seconds
Converting cached_user_roles...79 records converted in 0.46019819378852844 seconds
Converting cached_usergroup_members...0 records converted in 0.2176203727722168 seconds
Converting compute_attributes...22 records converted in 0.32057303190231323 seconds
Converting compute_profiles...20 records converted in 0.22419188916683197 seconds
Converting compute_resources...2 records converted in 0.3565940782427788 seconds
Converting config_group_classes...0 records converted in 0.18822918087244034 seconds
Converting config_groups...0 records converted in 0.036217100918293 seconds
Converting domains...15 records converted in 0.18824415653944016 seconds
Converting dynflow_actions...rake aborted!
NoMethodError: undefined method `fetch_value' for nil:NilClass
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/attribute_methods/read.rb:71:in `_read_attribute'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/attribute_methods/read.rb:36:in `__temp__36c6163737'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/core.rb:358:in `init_with'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/persistence.rb:69:in `instantiate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/querying.rb:50:in `block (2 levels) in find_by_sql'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/result.rb:55:in `block in each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/result.rb:55:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/result.rb:55:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/querying.rb:50:in `map'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/querying.rb:50:in `block in find_by_sql'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/querying.rb:49:in `find_by_sql'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation.rb:678:in `exec_queries'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation.rb:546:in `load'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation.rb:255:in `records'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/usr/share/foreman/lib/tasks/convert.rake:125:in `block (5 levels) in <top (required)>'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
/usr/share/foreman/lib/tasks/convert.rake:124:in `block (4 levels) in <top (required)>'
/usr/share/foreman/lib/tasks/convert.rake:83:in `each'
/usr/share/foreman/lib/tasks/convert.rake:83:in `block (3 levels) in <top (required)>'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:convert:prod2dev
Maybe worth to note: I created table template_inputs manually. (as suggested in similar posts)
CREATE TABLE ātemplate_inputsā (
āidā SERIAL NOT NULL,
ānameā VARCHAR(255) NOT NULL,
ārequiredā BIT(1) NOT NULL DEFAULT Eā0ā,
āinput_typeā VARCHAR(255) NOT NULL,
āfact_nameā VARCHAR(255) NULL DEFAULT NULL,
āvariable_nameā VARCHAR(255) NULL DEFAULT NULL,
āpuppet_class_nameā VARCHAR(255) NULL DEFAULT NULL,
āpuppet_parameter_nameā VARCHAR(255) NULL DEFAULT NULL,
ādescriptionā TEXT NULL DEFAULT NULL,
ātemplate_idā INTEGER NULL DEFAULT NULL,
ācreated_atā DATE NULL DEFAULT NULL,
āupdated_atā DATE NULL DEFAULT NULL,
āoptionsā TEXT NULL DEFAULT NULL,
āadvancedā BIT(1) NOT NULL DEFAULT Eā0ā
)