peatio icon indicating copy to clipboard operation
peatio copied to clipboard

DB setup error: Ask unit is not included in the list, Bid unit is not included in the list

Open Coding-Jewelry opened this issue 8 years ago • 11 comments

Hi.

Now I am trying to install Rubykube peatio project on Ubuntu. While I run the command to setup database ("bundle exec rake db:setup"), then it causes an error like the followings.

rake aborted! ActiveRecord::RecordInvalid: Validation failed: Ask unit is not included in the list, Bid unit is not included in the list /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/validations.rb:79:in raise_record_invalid' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/validations.rb:43:in save!' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_methods/dirty.rb:29:in save!' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:291:in block in save!' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:351:in block in with_transaction_returning_status' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:348:in with_transaction_returning_status' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:291:in save!' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/persistence.rb:51:in create!' /home/Vinod/code/peatio/lib/tasks/markets.rake:10:in block (4 levels) in <top (required)>' /home/Vinod/code/peatio/lib/tasks/markets.rake:8:in each' /home/Vinod/code/peatio/lib/tasks/markets.rake:8:in block (3 levels) in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in block in transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/transaction.rb:184:in within_new_transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in transaction' /home/Vinod/code/peatio/lib/tasks/markets.rake:7:in block (2 levels) in <top (required)>' /home/Vinod/code/peatio/db/seeds.rb:5:in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in block in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in load_dependency' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/railties-4.2.10/lib/rails/engine.rb:547:in load_seed' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/tasks/database_tasks.rb:253:in load_seed' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:173:in block (2 levels) in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/rake-12.3.1/exe/rake:27:in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in eval' /home/Vinod/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `

' Tasks: TOP => markets:seed

I am not sure how I can fix this error. Please let me know if you know the fix way.

Thanks.

Coding-Jewelry avatar Jun 03 '18 18:06 Coding-Jewelry

You can try bundle exec rake db:migrate db:seed

DonaldChiang avatar Jun 04 '18 08:06 DonaldChiang

Still not working. The same error is displayed.

Coding-Jewelry avatar Jun 04 '18 08:06 Coding-Jewelry

Don't use db:setup, use bin/init_config && bundle exec db:drop db:create db:migrate db:seed.

yivo avatar Jun 04 '18 12:06 yivo

When I did one by one:

  • bin/init_config
  • bundle exec db:drop
  • bundle exec db:migrate Worked successfully so far. But when I ran "bundle exec db:seed", another error was occurred, just like...

ActiveRecord::UnknownAttributeError: unknown attribute 'visible' for Market. /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:59:in rescue in _assign_attribute' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:53:in _assign_attribute' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:41:in block in assign_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:35:in each' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:35:in assign_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/core.rb:566:in init_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/core.rb:281:in initialize' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/inheritance.rb:61:in new' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/inheritance.rb:61:in new' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/persistence.rb:50:in create!' /home/Vinod/code/peatio/lib/tasks/markets.rake:10:in block (4 levels) in <top (required)>' /home/Vinod/code/peatio/lib/tasks/markets.rake:8:in each' /home/Vinod/code/peatio/lib/tasks/markets.rake:8:in block (3 levels) in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in block in transa ction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/transaction.rb:184:in within_new_transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in transaction' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in transaction' /home/Vinod/code/peatio/lib/tasks/markets.rake:7:in block (2 levels) in <top (required)>' /home/Vinod/code/peatio/db/seeds.rb:5:in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in block in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in load_dependency' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in load' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/railties-4.2.10/lib/rails/engine.rb:547:in load_seed' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/tasks/database_tasks.rb:253:in load_seed' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:173:in block (2 levels) in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/rake-12.3.1/exe/rake:27:in <top (required)>' /home/Vinod/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in eval' /home/Vinod/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `

'

Caused by: NoMethodError: undefined method visible=' for #<Market:0x000055f0f439d880> /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activemodel-4.2.10/lib/active_model/attribute_methods.rb:433:in method_missing' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:54:in public_send' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:54:in _assign_attribute' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:41:in block in assign_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:35:in each' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/attribute_assignment.rb:35:in assign_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/core.rb:566:in init_attributes' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/core.rb:281:in initialize' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/inheritance.rb:61:in new' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/inheritance.rb:61:in new' /home/Vinod/.rvm/gems/ruby-2.5.0/gems/activerecord-4.2.10/lib/active_record/persistence.rb:50:in create!'

So it tells me that there isn't any field named "visible" in markets table. But in markets seed file (config/templates/seed/markets.yml.erb), there are "visible" items for every data.

Coding-Jewelry avatar Jun 05 '18 06:06 Coding-Jewelry

You can check the migration file 20180325001828_create_markets.rb image

DonaldChiang avatar Jun 05 '18 06:06 DonaldChiang

What is the version?

yivo avatar Jun 05 '18 07:06 yivo

I have just checked the migration file and current DB schema on MySQL. I think that the migration file is in normality, but unfortunately there isn't any filed named "visible" in MySQL table. 1 2

Coding-Jewelry avatar Jun 05 '18 08:06 Coding-Jewelry

Please use 1-8-stable. Everything is fine there.

yivo avatar Jun 05 '18 10:06 yivo

Thanks for letting me know, Yivo. One more question... this Peatio works on Ubuntu 18.04 or 16.04 as well?

Coding-Jewelry avatar Jun 05 '18 11:06 Coding-Jewelry

We support only Docker environment.

yivo avatar Jun 05 '18 13:06 yivo

Use correct version of Peatio and DB. Closed.

yivo avatar Jun 07 '18 12:06 yivo