#環境
ruby 2.40
rails 5.2.2.1
#問題の画面
ActiveRecord::PendingMigrationError Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development Extracted source (around line #579): # Raises <tt>ActiveRecord::PendingMigrationError</tt> error if any migrations are pending. def check_pending!(connection = Base.connection) raise ActiveRecord::PendingMigrationError if connection.migration_context.needs_migration? end def load_schema_if_pending!
#rake db:migrateしたときの画面
== 20190325084941 CreateUsers: migrating ====================================== -- create_table(:users) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `username' for #<ActiveRecord::ConnectionAdapters::SQLite3::TableDefinition:0x363e028> /home/pi/rails/mitakalab-twitter/db/migrate/20190325084941_create_users.rb:6:in `block in change' /home/pi/rails/mitakalab-twitter/db/migrate/20190325084941_create_users.rb:3:in `change' Caused by: NoMethodError: undefined method `username' for #<ActiveRecord::ConnectionAdapters::SQLite3::TableDefinition:0x363e028> /home/pi/rails/mitakalab-twitter/db/migrate/20190325084941_create_users.rb:6:in `block in change' /home/pi/rails/mitakalab-twitter/db/migrate/20190325084941_create_users.rb:3:in `change' Tasks: TOP => db:migrate (See full trace by running task with --trace)
#試したこと
rake db:reset
しかし改善しませんでした。
どうしたらいいですか?
教えてください
#追記
これが、/db/migrate/20190325084941_create_users.rbです。
何か問題はありませんか?
ruby
1class CreateUsers < ActiveRecord::Migration[5.2] 2 def change 3 create_table :users do |t| 4 t.string :name 5 t.string :username 6 t.username :location 7 t.text :about 8 9 t.timestamps 10 end 11 end 12end
20190325084941_create_users.rbに間違いがありそうです
回答2件
あなたの回答
tips
プレビュー