Can not update from 1.1.3 to 1.2.0 because of the 6to5 gem (now known as babel)


(Raul ) #1

Hi all,

Please I need some help because of the 6to5 gem now renamed as babel, I am aware of the issue already closed here Cannot upgrade from Docker Manager (missing gem) but those changes has not been ported to older versions in git (at least in tags v1.2.0.*)

The thing is I am trying to update from 1.1.3 to the latest one 1.3.0.beta7, so makes sense that next command crashes because misses some database changes done before in the 1.2.0.x versions

    RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake db:migrate --trace
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Invoke db:load_config (first_time)
    ** Execute db:load_config
    ** Invoke set_locale (first_time)
    ** Execute set_locale
    ** Execute db:migrate
    == 20150325190959 CreateQueuedPosts: migrating ================================
    -- create_table(:queued_posts, {:force=>true})
    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:
    
    PG::UndefinedObject: ERROR:  type "json" does not exist
    LINE 1: ...ger NOT NULL, "raw" text NOT NULL, "post_options" json NOT N...
                                                                 ^
    : CREATE TABLE "queued_posts" ("id" serial primary key, "queue" character varying(255) NOT NULL, "state" integer NOT NULL, "user_id" integer NOT NULL, "raw" text NOT NULL, "post_options" json NOT NULL, "topic_id" integer, "approved_by_id" integer, "approved_at" timestamp, "rejected_by_id" integer, "rejected_at" timestamp, "created_at" timestamp, "updated_at" timestamp) /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.3/lib/patches/db/pg.rb:90:in `exec'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.3/lib/patches/db/pg.rb:90:in `async_exec'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:378:in `block in log'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:372:in `log'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/schema_statements.rb:205:in `create_table'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:656:in `block in method_missing'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:628:in `block in say_with_time'
    /home/kingadmin/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:628:in `say_with_time'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:648:in `method_missing'
    /fjord/discourse/db/migrate/20150325190959_create_queued_posts.rb:3:in `change'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:602:in `exec_migration'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
    /home/kingadmin/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:585:in `block in migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:584:in `migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:759:in `migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:208:in `transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:1044:in `ddl_transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:959:in `block in migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:955:in `each'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:955:in `migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:814:in `up'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/migration.rb:792:in `migrate'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.10/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
    /home/kingadmin/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
    /fjord/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
    Tasks: TOP => db:migrate

But the, if I **try to update from v 1.1.3 to 1.2.0**, then bundle complains of the missing 6to5 gem

    $ bundle install --without test --deployment
    Fetching gem metadata from https://rubygems.org/.......
    Fetching version metadata from https://rubygems.org/...
    Fetching dependency metadata from https://rubygems.org/..
    Could not find 6to5-source-3.3.7 in any of the sources

I tried to do a dirty workaround, I did the next:

  • Delete the Gemfile.lock

  • Edit the Gemfile line 110 like this (comment gem 6to5 and add babel
    instead)

      110 #gem '6to5'
      111 gem 'babel'
    
  • Edit the .bundle/config setting BUNDLE_FROZEN: ‘0’ in order to do
    not complain of the version control Gemfile.lock needed

  • Launch ‘bundle install’, in order to have a brand new Gemfile.lock,
    and again bundle install --without test --deployment without any
    prompting error

But then again when trying to update the database the 6to5 dependency appears again:

RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake db:migrate --trace
rake aborted!
LoadError: cannot load such file -- 6to5
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb:2:in `<top (required)>'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/lib/es6_module_transpiler/tilt.rb:2:in `<top (required)>'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/lib/es6_module_transpiler/rails.rb:2:in `<top (required)>'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/fjord/discourse/config/application.rb:32:in `<class:Application>'
/fjord/discourse/config/application.rb:19:in `<module:Discourse>'
/fjord/discourse/config/application.rb:18:in `<top (required)>'
/fjord/discourse/Rakefile:5:in `require'
/fjord/discourse/Rakefile:5:in `<top (required)>'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/fjord/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/fjord/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/fjord/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'

So as a summary error shows this: “rake aborted! LoadError: cannot load such file – 6to5”

I read in the closed topic Cannot upgrade from Docker Manager (missing gem) that the needed changes to substitute 6to5 gem to babel were done already in git ( I am not on Docker) , but maybe not in the older versions?

Please will appreciate really a lot any hint to work around this, so the aim is to do the necessary upgrades to reach latest production version

Many thanks in advance!


(Robin Ward) #2

Actually that first error looks like your version of postgres is insufficient. It doesn’t have the json type which is now required.

Now to fix the babel issue (argh! why would they delete a gem?!?!) it should be as simple as replacing 6to5 in Gemfile and Gemfile.lock. I wouldn’t delete Gemfile.lock, that will cause all sorts of problems.


(Raul ) #3

Hi,

Thanks a lot for your fast reply, will work towards postgres version upgrade in order to have the json type, I think this will be the cleanest solution to upgrade directly to the latests Discourse version :grinning: .

I do not know how critical can be considered this issue, but for those that need intermediate upgrades from 1.1.3 to 1.2.0.x will appreciate a lot if the needed Gemflile* files are updated in git, (maybe another tag or modifying the oldest ones if possible ?)

Regards!


(Jeff Atwood) #4

Yes the most relevant error is

StandardError: An error has occurred, this and all later migrations canceled:
    
PG::UndefinedObject: ERROR:  type "json" does not exist