mysql> SHOW CREATE TABLE user_preference;
+---------------------------------------------------------------------------------------------------------+
|CREATE TABLE `user_preference` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`field` varchar(255) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_preference_user_id_idx` (`user_id`)
CONSTRAINT `user_preference_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+---------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------+
|CREATE TABLE `user_preference` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`field` varchar(255) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_preference_user_id_idx` (`user_id`)
CONSTRAINT `user_preference_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+---------------------------------------------------------------------------------------------------------+
mysql> ALTER TABLE user_preference DROP FOREIGN KEY user_preference_user_id;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE user_preference DROP user_id;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE user_preference DROP user_id;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
Sem comentários:
Enviar um comentário