Welcome Guest, Not a member yet? Register   Sign In
Error creating table with DBForge using enum
#4

(04-20-2015, 06:20 AM)mwhitney Wrote: Generally, I avoid using the string format unless absolutely necessary, which, so far, has only been the case for setting things like 'CURRENT_TIMESTAMP'. In this case, my work-around is to move the 'constraint' into the 'type' field, like this:


PHP Code:
       'status' => array(
 
           'type' => "ENUM('active','inactive','deleted')",
 
           'default' => 'active',
 
           'null' => false,
 
       ), 


Since ENUM is a MySQL-specific type anyway, it's not the worst work-around, but it would be nice if I could use the constraint.

Was looking for a work around for this as well, and came to the same conclusion you did.

PHP Code:
$db_columns = array(
 
   'status' => array(
 
       'type'          => "ENUM('unlocked','locked')",
 
       'default'       => 'unlocked',
 
       'comment'       => 'Status of asset (Locked or Unlocked)'
 
   )
); 

And its the same thing for SET
Reply


Messages In This Thread
RE: Error creating table with DBForge using enum - by jLinux - 09-21-2015, 03:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB