Sean Thompson
Sean Thompson

Reputation: 31

How to I make Rails recognise the version of sqlite3 I've added to usr/bin?

I'm trying to get Rail 6 running on Amazon Linux, but it doesn't have a new enough version of sqlite3

The latest version of sqlite3 on Amazon Linux is 3.7.17. I need at least 3.8 for my version of Rails 6. I resolved it by renaming the existing sqlite3 binary, replacing it with a downloaded one, and installing some required libraries. I can now query its version.

ec2-user:~/environment $ sqlite3 --version                                                             
3.29.0 2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6
ec2-user:~/environment $ whereis sqlite3
sqlite3: /usr/bin/sqlite3.7 /usr/bin/sqlite3 /usr/include/sqlite3.h /opt/c9/bin/sqlite3 /usr/share/man/man1/sqlite3.1.gz

With the Rails server running, I get the following error in the browser.

RuntimeError
Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8.
Extracted source (around line #336):

334      def check_version # :nodoc:
335        if database_version < "3.8.0"
336          raise "Your version of SQLite (#{database_version}) is too old. Active Record supports SQLite >= 3.8."
337        end
338      end
339

Rails.root: /home/ec2-user/environment/teachify

Application Trace | Framework Trace | Full Trace
activerecord (6.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:336:in `check_version' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `block in new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `tap' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:923:in `checkout_new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:902:in `try_to_checkout_new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:863:in `acquire_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:587:in `checkout' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:431:in `connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:1111:in `retrieve_connection' 
activerecord (6.0.0) lib/active_record/connection_handling.rb:231:in `retrieve_connection' 

(there's some more stack trace if needed)

Upvotes: 0

Views: 1052

Answers (1)

konyak
konyak

Reputation: 11716

I believe you also need to

  • install newer libsqlite3-dev
  • gem uninstall sqlite3
  • gem install sqlite3

Upvotes: 1

Related Questions