Key column '' doesn't exist in table while the column exists

Viewed 34

i have a simple and weird problem . when i run

 alter table verizon_device_usages drop verizon_device_id

mysql gives this error .

alter table verizon_device_usages drop verizon_device_id
> 1072 - Key column 'verizon_device_id' doesn't exist in table
> Time: 0.003s

but when i run

 alter table verizon_device_usages ADD COLUMN verizon_device_id VARCHAR(15)

my sql returns this error :

alter table verizon_device_usages ADD COLUMN verizon_device_id VARCHAR(15)
> 1060 - Duplicate column name 'verizon_device_id'
> Time: 0.02s

i just want to remove that column with laravel migration or even query but i cant . any idea why its like that ?? i can see the column on table exists

1 Answers

I guess you've simply lost column in your script:

alter table verizon_device_usages drop column verizon_device_id;

see also here

However the official documentation says:

The word COLUMN is optional and can be omitted, except for RENAME COLUMN (to distinguish a column-renaming operation from the RENAME table-renaming operation).

Related