I’ve got an import script that was working. I changed databases that I was importing from.
Now when I try to create a category, it fails, complaining about last_post_user_id
. The first line shows what I’m passing to create_category. It doesn’t look like that topic insert includes a username. Could that be it? Has something changed that broke this? I don’t see any recent changes to base.rb
or category.rb
. I’m rather stumped.
Cat: 1: Reporting Forums -- When problems are reported they go in this forum.
/home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-mini-profiler-0.10.4/lib/patches/db/pg.rb:90:in `async_exec': PG::NotNullViolation: ERROR: null value in column "last_post_user_id" violates not-null constraint (ActiveRecord::StatementInvalid)
DETAIL: Failing row contains (15, About the Reporting Forums category, null, 2017-06-05 23:33:54.162645, 2017-06-05 23:33:54.162645, 0, 0, null, null, 0, null, null, null, null, null, 0, null, 0, 0, 19, t, 0, f, f, 2017-06-05 23:33:54.162931, f, 0, regular, null, 0, 0, 2017-06-05 23:33:54.108265, null, 1, null, about-the-reporting-forums-category, null, null, null, null, 1, null, null, f, f, null, null, About the Reporting Forums category, 0, null, null, null, null, null, null).
: INSERT INTO "topics" ("slug", "title", "pinned_at", "category_id", "fancy_title", "created_at", "updated_at", "bumped_at") VALUES ('about-the-reporting-forums-category', 'About the Reporting Forums category', '2017-06-05 23:33:54.108265', 19, 'About the Reporting Forums category', '2017-06-05 23:33:54.162645', '2017-06-05 23:33:54.162645', '2017-06-05 23:33:54.162931') RETURNING "id"
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-mini-profiler-0.10.4/lib/patches/db/pg.rb:90:in `async_exec'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `exec_no_cache'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:584:in `execute_and_clear'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:192:in `exec_insert'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation.rb:64:in `insert'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:524:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/counter_cache.rb:139:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/locking/optimistic.rb:75:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/attribute_methods/dirty.rb:133:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:306:in `block in _create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:306:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/timestamp.rb:57:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:504:in `create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:302:in `block in create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:302:in `create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:142:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/validations.rb:43:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:291:in `block in save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:220:in `transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:291:in `save!'
from /home/pfaffman/src/discourse/app/models/category.rb:206:in `create_category_definition'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:432:in `block in make_lambda'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:506:in `block in call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:506:in `each'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:506:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:306:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/timestamp.rb:57:in `_create_record'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:504:in `create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:302:in `block in create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/callbacks.rb:302:in `create_or_update'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/persistence.rb:142:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/validations.rb:43:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:291:in `block in save!'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:220:in `transaction'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
from /home/pfaffman/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/transactions.rb:291:in `save!'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:408:in `create_category'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:377:in `block in create_categories'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:358:in `each'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:358:in `collect'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:358:in `each'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:358:in `create_categories'
from script/import_scripts/telligent.rb:135:in `import_categories'
from script/import_scripts/telligent.rb:56:in `execute'
from /home/pfaffman/src/discourse/script/import_scripts/base.rb:45:in `perform'
from script/import_scripts/telligent.rb:348:in `<main>'