1

I'm getting this error:

  • SQLSTATE[HY000]: General error: 1025 Error on rename of './salt/ghost' to './salt/#sql2-4ab-630b' (errno: 152). Failing Query: "ALTER TABLE ghost DROP FOREIGN KEY ghost.row_id"

I looked for some information but I didn't get a solution..any help?

This is my DDL:

ghost,"CREATE TABLE `ghost` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `packet_number` int(11) DEFAULT NULL,
  `tbl_name` varchar(50) DEFAULT NULL,
  `row_id` int(11) DEFAULT NULL,
  `row_id2` int(11) DEFAULT NULL,
  `column_name` varchar(50) DEFAULT NULL,
  `old_value` mediumblob,
  `new_value` mediumblob,
  `ghost_action` varchar(255) DEFAULT NULL,
  `ghost_user_id` int(11) DEFAULT NULL,
  `ghost_action_comments` varchar(255) DEFAULT NULL,
  `ghost_status_id` int(11) DEFAULT '1',
  `ghost_status_comments` varchar(255) DEFAULT NULL,
  `serialized` mediumblob,
  `parent_id` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_by` bigint(20) DEFAULT NULL,
  `updated_by` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_change_1_idx` (`ghost_user_id`),
  KEY `fk_change_2_idx` (`ghost_status_id`),
  KEY `row_id2_idx` (`row_id2`),
  CONSTRAINT `ghost_ghost_status_id_ghost_status_id` FOREIGN KEY (`ghost_status_id`) REFERENCES `ghost_status` (`id`),
  CONSTRAINT `ghost_ghost_user_id_sf_guard_user_id` FOREIGN KEY (`ghost_user_id`) REFERENCES `sf_guard_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=120450 DEFAULT CHARSET=utf8"

Javi

0

1 Answer 1

1

Without knowing your DDL, I did find this on the docs regarding error code 1025, in one of the user comments:

To avoid getting this error while trying to drop a foreign key, use the constraint name rather than the column name of the foreign key.

So, instead of dropping the ghost.row_id column, try dropping the foreign key using the FK name.

2
  • Thanks DTest, could you tell what is the FK name?
    – tirenweb
    Commented Feb 20, 2012 at 17:15
  • @user248959 Err, you don't seem to have a foreign key for row_id2 Commented Feb 20, 2012 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.