vendredi 18 octobre 2019

cant rake db:migrate undefined method erorr

Hi guys I am new to rails and just getting started. Everytime I try to run rake db:migrate I get this(trace):

rake db:migrate == CreateModelNames: migrating =============================================== -- create_table(:model_names) rake aborted! StandardError: An error has occurred, all later migrations canceled:

undefined method feldtyp' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x7f729807cfa8>./db/migrate//20191018075455_create_model_names.rb:4:inup_without_benchmarks' ./db/migrate//20191018075455_create_model_names.rb:3:in up_without_benchmarks' (__DELEGATION__):2:insend' (DELEGATION):2:in `migrate' Tasks: TOP => db:migrate (See full trace by running task with --trace) david@david-desktop:~/Railsprojekte/david$ rake db:migrate --trace** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateModelNames: migrating =============================================== -- create_table(:model_names) rake aborted! StandardError: An error has occurred, all later migrations canceled:

undefined method feldtyp' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x7f61a32f62f8>./db/migrate//20191018075455_create_model_names.rb:4:inup_without_benchmarks' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in create_table' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:445:increate_table' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:346:in send' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:346:inmethod_missing' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:326:in say_with_time' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:326:in say_with_time' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:342:inmethod_missing' ./db/migrate//20191018075455_create_model_names.rb:3:in up_without_benchmarks' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:280:insend' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:280:in migrate' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:280:in migrate' (__DELEGATION__):2:insend' (DELEGATION):2:in migrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:480:inmigrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:556:in call' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:556:inddl_transaction' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:479:in migrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:466:ineach' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:466:in migrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:394:inup' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb:377:in migrate' /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:111 /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:240:incall' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:240:in execute' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:235:ineach' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:235:in execute' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:179:ininvoke_with_call_chain' /usr/local/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:172:ininvoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/task.rb:165:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:150:ininvoke_task' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:106:in top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:106:ineach' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:106:in top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:115:inrun_with_threads' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:100:in top_level' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:78:inrun' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:176:in standard_exception_handling' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/lib/rake/application.rb:75:inrun' /usr/local/lib/ruby/gems/1.8/gems/rake-10.4.2/bin/rake:33 /usr/local/bin/rake:26:in `load' /usr/local/bin/rake:26 Tasks: TOP => db:migrate

My code is this:

class CreateModelNames < ActiveRecord::Migration def self.up create_table :model_names do |t| t.feldtyp :feld_name

  t.timestamps
end

end

def self.down drop_table :model_names end end

Any help would be apreeated :)

LG

Aucun commentaire:

Enregistrer un commentaire