при запуске rake db:migrate
я получаю это сообщение об ошибке:
rake aborted!
ActiveRecord::StatementInvalid: SQLite3::ReadOnlyException: attempt to write a readonly database: CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `step'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `block in each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `loop'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `map'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `block in execute'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:95:in `prepare'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:255:in `block (2 levels) in execute'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:254:in `block in execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:253:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:311:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/schema_migration.rb:29:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1187:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `up'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1011:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Caused by:
SQLite3::ReadOnlyException: attempt to write a readonly database
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `step'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `block in each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `loop'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `map'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `block in execute'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:95:in `prepare'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:255:in `block (2 levels) in execute'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:254:in `block in execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:253:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:311:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/schema_migration.rb:29:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1187:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `up'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1011:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
это результат ls -l
:
total 72
drwxrwxrwx 10 root root 4096 Jun 3 14:23 app
drwxrwxrwx 2 root root 4096 Jun 3 14:24 bin
drwxrwxrwx 5 root root 4096 Jun 3 14:23 config
-rw-rw-rw- 1 root root 130 Jun 3 14:23 config.ru
drwxrwxrwx 3 root root 4096 Jun 3 23:47 db
-rw-rw-rw- 1 root root 2205 Jun 3 14:23 Gemfile
-rw-rw-rw- 1 root root 5295 Jun 3 14:24 Gemfile.lock
drwxrwxrwx 4 root root 4096 Jun 3 14:23 lib
drwxrwxrwx 2 root root 4096 Jun 3 14:28 log
-rw-rw-rw- 1 root root 66 Jun 3 14:23 package.json
drwxrwxrwx 2 root root 4096 Jun 3 14:23 public
-rw-rw-rw- 1 root root 227 Jun 3 14:23 Rakefile
-rw-rw-rw- 1 root root 374 Jun 3 14:23 README.md
drwxrwxrwx 2 root root 4096 Jun 3 14:23 storage
drwxrwxrwx 9 root root 4096 Jun 3 14:23 test
drwxrwxrwx 6 root root 4096 Jun 3 14:42 tmp
drwxrwxrwx 2 root root 4096 Jun 3 14:23 vendor
это результат выполнения оригинальной командыдобавляется --trace
:
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
rake aborted!
ActiveRecord::StatementInvalid: SQLite3::ReadOnlyException: attempt to write a readonly database: CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `step'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `block in each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `loop'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `map'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `block in execute'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:95:in `prepare'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:255:in `block (2 levels) in execute'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:254:in `block in execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:253:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:311:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/schema_migration.rb:29:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1187:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `up'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1011:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Caused by:
SQLite3::ReadOnlyException: attempt to write a readonly database
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `step'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108:in `block in each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `loop'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:107:in `each'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `map'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:152:in `block in execute'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:95:in `prepare'
/var/lib/gems/2.3.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:255:in `block (2 levels) in execute'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:254:in `block in execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/var/lib/gems/2.3.0/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:253:in `execute'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:311:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/schema_migration.rb:29:in `create_table'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1187:in `initialize'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `new'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1036:in `up'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/migration.rb:1011:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/var/lib/gems/2.3.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:83:in `block in run'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:80:in `run'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
мой файл database.yml:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
снова с отношением кода к тексту:
dfgdfghd fghdfg hdfghdgh dfghdfgh dfghdfghd fgghdfghdfhdghdfg hdfgghdf ghdfghdf hdfghdf ghdfghd fghdf ghdfg ч dfghdfg ч dfgh dfgh dghdfgf hdfgh fgdfgfhdfg hdfgh fghdf ghdfg dfghd fhdf ghdf hdfg hdghdf ghdfgh dghdfgh dfgndfn fgndf gndfgn dfgfn DF ndfg нсг ndfg дг п ДФГ п dfgndfgndf gndfg ndfgnfg HDF ghdfh gfndfgh dfghdf gdfgh dfgh hdfh dfghdf ghdfg HFGhdfg hdf g
вывод ls -l
в каталоге db:
total 8
-rw-r--r-- 1 root root 0 Jun 3 14:42 development.sqlite3
drwxrwxr-x 2 jack jack 4096 Jun 3 23:47 migrate
-rw-rw-rw- 1 root root 370 Jun 3 14:23 seeds.rb