Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql WorkBench : Default varchar value as empty

Before I started using MySql WorkBench, I was using phpmyadmin and liked to set default values of varchars to empty. So in my code I would not have to check for null values and could only use if $value = '' comparisions. How do I put default value as empty in mysql workbench? If i leave the text box empty unlike phpmyadmin it thinks I do not want any default value.

Thanking you

Imran

like image 228
Imran Omar Bukhsh Avatar asked Aug 04 '13 01:08

Imran Omar Bukhsh


2 Answers

The workbench has a bug an fails to update the empty string (it says, no changes). I set it to a space first ' ', and then change the sql code to an empty string ''. That does the trick.

like image 190
mirko van colen Avatar answered Oct 22 '22 11:10

mirko van colen


Just put two quotes '' in default field for your column.

Assigning an empty string as a default value in MySql Workbench

Or right-click on a column and choose Default ''

Assigning an empty string as a default value from context menu in MySql Workbench

like image 23
peterm Avatar answered Oct 22 '22 13:10

peterm