mercredi 13 mai 2015

Mysql2::Error: Table 'xx' doesn't exist: SHOW CREATE TABLE `xx`

When i try to rake db:migrate i get the following issues.

** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
   (0.5ms)  SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()
   (0.3ms)  SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()
  ActiveRecord::SchemaMigration Load (0.2ms)  SELECT `schema_migrations`.* FROM `schema_migrations`
Migrating to CreateWowUsers (20150201000000)
== 20150201000000 CreateWowUsers: migrating ===================================
-- create_table("wow_users")
   (0.4ms)  SHOW CREATE TABLE `wow_users`
Mysql2::Error: Table 'wowgame_development.wow_users' doesn't exist: SHOW CREATE TABLE `wow_users`
   (0.4ms)  SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()
   (0.3ms)  SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()
   (15.2ms)  CREATE TABLE `wow_users` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(64), `email` varchar(64), `active` tinyint(1) DEFAULT 0, `account_type` tinyint(1) DEFAULT 1, `has_avatar` tinyint(1) DEFAULT 0, `type` tinyint, `realname` varchar(128) DEFAULT '', `address` text, `address1` varchar(1000), `city` varchar(60), `state` varchar(60), `zip` varchar(15), `country` varchar(40) DEFAULT '', `dob` date, `gender` varchar(10), `phone` varchar(15) DEFAULT '', `credits_balance` int(11) DEFAULT 0, `accepted_game_terms` int(11), `first_name` varchar(255), `last_name` varchar(255),  INDEX `fk__wow_users_user_id`  (`user_id`) , CONSTRAINT fk_wow_users_user_id FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)) ENGINE=InnoDB
Mysql2::Error: Cannot add foreign key constraint: CREATE TABLE `wow_users` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(64), `email` varchar(64), `active` tinyint(1) DEFAULT 0, `account_type` tinyint(1) DEFAULT 1, `has_avatar` tinyint(1) DEFAULT 0, `type` tinyint, `realname` varchar(128) DEFAULT '', `address` text, `address1` varchar(1000), `city` varchar(60), `state` varchar(60), `zip` varchar(15), `country` varchar(40) DEFAULT '', `dob` date, `gender` varchar(10), `phone` varchar(15) DEFAULT '', `credits_balance` int(11) DEFAULT 0, `accepted_game_terms` int(11), `first_name` varchar(255), `last_name` varchar(255),  INDEX `fk__wow_users_user_id`  (`user_id`) , CONSTRAINT fk_wow_users_user_id FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)) ENGINE=InnoDB
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Can someone help me with this?

Aucun commentaire:

Enregistrer un commentaire