Issue
This Content is from Stack Overflow. Question asked by Farshad
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
Solution
I guess you’ve simply lost column
in your script:
alter table verizon_device_usages drop column verizon_device_id;
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).
This Question was asked in StackOverflow by Farshad and Answered by asd-tm It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.