How to delete a column when it has a foreign key contraint:

I am trying to:

[CODE]
ALTER TABLE `appointments_clinic` DROP `logo_id`;
[/CODE]

But I get an error:
[CODE]
#1553 – Cannot drop index ‘appointments_clinic_logo_id_240e2dee_fk_clinic_profilepic_id’: needed in a foreign key constraint
[/CODE]

I then drop the foreign key before trying again:
[CODE]
mysql> use appointmentsdj;
mysql> SHOW CREATE TABLE;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1
mysql> SHOW CREATE TABLE appointments_clinic;
+———————+———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————+
| Table | Create Table |
+———————+———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————+
| appointments_clinic | CREATE TABLE `appointments_clinic` (
`clinicid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL,
`label` varchar(25) NOT NULL,
`email` varchar(50) NOT NULL,
`mobile` varchar(15) NOT NULL,
`alternate` varchar(15) NOT NULL,
`about` varchar(250) NOT NULL,
`state` varchar(25) NOT NULL,
`city` varchar(35) NOT NULL,
`locality` varchar(35) NOT NULL,
`pincode` int(11) NOT NULL,
`address` longtext NOT NULL,
`website` varchar(200) NOT NULL,
`logo_id` int(11) DEFAULT NULL,
PRIMARY KEY (`clinicid`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `label` (`label`),
UNIQUE KEY `appointments_clinic_name_mobile_email_8b234fe7_uniq` (`name`,`mobile`,`email`),
KEY `appointments_clinic_logo_id_240e2dee_fk_clinic_profilepic_id` (`logo_id`),
CONSTRAINT `appointments_clinic_logo_id_240e2dee_fk_clinic_profilepic_id` FOREIGN KEY (`logo_id`) REFERENCES `clinic_profilepic` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 |
+———————+———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————+
1 row in set (0.00 sec)
[/CODE]

I then drop the foreign key contraint:
[CODE]
mysql> ALTER TABLE appointments_clinic DROP FOREIGN KEY appointments_clinic_logo_id_240e2dee_fk_clinic_profilepic_id;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
[/CODE]

And then I delete the coloumn:
[CODE]
mysql> ALTER TABLE `appointments_clinic` DROP `logo_id`;
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0
[/CODE]

Summary:

mysql> show tables;
+-------------------------------------+
| Tables_in_appointmentsdj            |
+-------------------------------------+
| appointments_appointment            |
| appointments_billedqty              |
| appointments_billitem               |
| appointments_billmodel              |
| appointments_checkins               |
| appointments_clinic                 |
| appointments_clinical_record        |
| appointments_clinicpermissions      |
| appointments_customer               |
| appointments_doctor                 |
| appointments_links                  |
| appointments_prescription_drugs     |
| appointments_unconfirmedappointment |
| auth_group                          |
| auth_group_permissions              |
| auth_permission                     |
| auth_user                           |
| auth_user_groups                    |
| auth_user_user_permissions          |
| clinic_album                        |
| clinic_pic                          |
| clinic_profilepic                   |
| clinic_showcasephoto                |
| django_admin_log                    |
| django_content_type                 |
| django_migrations                   |
| django_session                      |
+-------------------------------------+
27 rows in set (0.00 sec)
mysql> desc appointments_checkins;
+-----------------+-------------+------+-----+---------+----------------+
| Field           | Type        | Null | Key | Default | Extra          |
+-----------------+-------------+------+-----+---------+----------------+
| checkinno       | int(11)     | NO   | PRI | NULL    | auto_increment |
| date            | date        | NO   |     | NULL    |                |
| time            | varchar(25) | NO   |     | NULL    |                |
| consulted       | int(11)     | NO   |     | NULL    |                |
| closed          | int(11)     | NO   |     | NULL    |                |
| hospitalid_id   | int(11)     | YES  | MUL | NULL    |                |
| linkedclinic_id | int(11)     | NO   | MUL | NULL    |                |
+-----------------+-------------+------+-----+---------+----------------+
7 rows in set (0.01 sec)
mysql> ALTER TABLE `appointments_checkins` DROP `hospitalid_id`;
ERROR 1553 (HY000): Cannot drop index 'appointments_checkin_hospitalid_id_37bc86b2_fk_appointme': needed in a foreign key constraint

mysql> ALTER TABLE `appointments_checkins` DROP FOREIGN KEY appointments_checkin_hospitalid_id_37bc86b2_fk_appointme;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE `appointments_checkins` DROP `hospitalid_id`;
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0