Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/08/2011, 08:57
Avatar de atapuerkasman
atapuerkasman
 
Fecha de Ingreso: febrero-2011
Mensajes: 76
Antigüedad: 13 años, 2 meses
Puntos: 2
Respuesta: Error foreign keys

He seleccionado mi shooterbd como schema default, no se si será esto. Pero al intentarlo de nuevo me da nuevos erroresç


Código:
ERROR 1005: Can't create table 'shooterbd.#sql-430_b9' (errno: 150)

SQL Statement:

ALTER TABLE `shooterbd`.`juego` 

  ADD CONSTRAINT `fk_usuarios`

  FOREIGN KEY (`user` )

  REFERENCES `shooterbd`.`usuario` (`nombre` )

  ON DELETE CASCADE

  ON UPDATE CASCADE

, ADD INDEX `fk_usuarios` (`user` ASC)



ERROR: Error when running failback script. Details follow.



ERROR 1050: Table 'juego' already exists

SQL Statement:

CREATE TABLE `juego` (

  `idJuego` int(11) NOT NULL AUTO_INCREMENT,

  `user` varchar(20) NOT NULL,

  `foto_disparo` varchar(45) DEFAULT NULL,

  `puntuacion` int(10) unsigned NOT NULL DEFAULT '0',

  `t_conexion` time NOT NULL DEFAULT '00:00:00',

  `t_penalizacion` time NOT NULL DEFAULT '00:00:00',

  `latitud` bigint(20) unsigned NOT NULL DEFAULT '0',

  `longitud` bigint(20) unsigned NOT NULL DEFAULT '0',

  `estado` tinyint(1) unsigned NOT NULL DEFAULT '0',

  `muerto` tinyint(1) unsigned NOT NULL DEFAULT '0',

  `destino_lat` bigint(20) unsigned NOT NULL DEFAULT '0',

  `destino_lon` bigint(20) unsigned NOT NULL DEFAULT '0',

  PRIMARY KEY (`idJuego`,`user`)

) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8

Supuestamente no me deja porque ya existe una tabla con ese nombre. O no lo hago bien o me está diciendo que vuelva a rehacer la BD. ¿Alguien puede ayudar?