0

I am trying to run Peatio, an asset exchange. While migrating DB

bin/rake db:migrate RAILS_ENV=development

I am getting following error.

== 20130624011823 CreateMembers: migrating ==================================== -- create_table(:members) rake aborted! StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE members (id int(11) DEFAULT NULL auto_increment PRIMARY KEY, sn varchar(255), name varchar(255), email varchar(255), pin_digest varchar(255), identity_id int(11), created_at datetime, updated_at datetime) ENGINE=InnoDB/home/firdoeshalikhan/Desktop/peatio/db/migrate/20130624011823_create_members.rb:3:in change' ActiveRecord::StatementInvalid: Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLEmembers(idint(11) DEFAULT NULL auto_increment PRIMARY KEY,snvarchar(255),namevarchar(255), emailvarchar(255),pin_digestvarchar(255),identity_id int(11),created_atdatetime,updated_atdatetime) ENGINE=InnoDB /home/firdoeshalikhan/Desktop/peatio/db/migrate/20130624011823_create_members.rb:3:in change' Mysql2::Error: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead /home/firdoeshalikhan/Desktop/peatio/db/migrate/20130624011823_create_members.rb:3:in `change' Tasks: TOP => db:migrate

Firdoesh
  • 73
  • 1
  • 2
  • 9
  • I'm guessing this is due to Rails 4.0.12 not being compatible with MySQL 5.7. https://stackoverflow.com/questions/21075515/creating-tables-and-problems-with-primary-key-in-rails – max Oct 12 '17 at 13:27
  • Either attempt to upgrade by changing the rails version in the Gemfile or use the workaround. Upgrading to 4.1x will fix it but 4.2x is preferable as it includes numerous security fixes. http://guides.rubyonrails.org/v4.2/upgrading_ruby_on_rails.html – max Oct 12 '17 at 13:31

0 Answers0