お世話になっております。
Railsで作ったデータベースを別環境から閲覧したいです。
データベースは初期から入れてあるSQLiteです。
config/database.yml
1 # SQLite version 3.x< 2 # gem install sqlite3< 3 # 4 # Ensure the SQLite 3 gem is defined in your Gemfile< 5 # gem 'sqlite3'< 6 # 7 default: &default< 8 adapter: sqlite3< 9 pool: 5< 10 timeout: 5000< 11 12 development:< 13 <<: *default< 14 database: db/development.sqlite3< 15 16 # Warning: The database defined as "test" will be erased and< 17 # re-generated from your development database when you run "ra> 18 # Do not set this db to the same as development or production.< 19 test:< 20 <<: *default< 21 database: db/test.sqlite3< 22 23 production:< 24 <<: *default< 25 database: db/production.sqlite3
そしてRails cですと、以下のようにデータベースが見れます。
irb(main):001:0> Rails c irb(main):002:0> hash = ActiveRecord::Base.connection.select_all("select * from aiueo").to_hash irb(main):003:0> hash {"id"=>1, "test"=>"data", "created_at"=>"2017-08-21 05:52:03.039753", "updated_at"=>"2017-08-21 05:52:03.039753"}]
これらをsqlite3コマンドで閲覧したいです。
以下のコマンドを試してみましたが、閲覧できませんでした。
sqlite3 test.sqlite3 sqlite> .database seq name file --- --------------- ---------------------------------------------------------- 0 main /Users/aaa/test.sqlite3
なんとかターミナル上で表示させたいです。
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/08/23 04:14