简体   繁体   中英

How to change field name to default NULL

I want to change my field name to default Null but i am unable to solve this issue Here i am trying to change my deleteAt field to defaut Null but its giving me the error

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'deletedAt timestamp default NULL' at line 1

Here is my code

DB::statement('ALTER TABLE insurance CHANGE COLUMN deleted_at deletedAt timestamp default NULL');

I want to set default NULL but i am unable to solve this and i am confused about this issue. your help need here

ALTER TABLE insurance CHANGE COLUMN deleted_at deletedAt timestamp default NULL

Is incorrect. Use this please.

ALTER TABLE insurance MODIFY COLUMN deleted_at timestamp NULL DEFAULT NULL

The word deletedAt isn't a valid syntax. There is an error in your query.

Try this

ALTER TABLE `insurance` CHANGE COLUMN `deleted_at` 
`deleted_at` TIMESTAMP NULL DEFAULT NULL;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM