Dears

I have an issue that the defined default value in db.py is not taken into 
the mysql table definition.
E.g. I define in db.py:

db.define_table('testcustomer',
    Field('country2','string', length=2, default='ch', label=T('Land')),
    Field('language2','string', length=2, default='de', label=T('Sprache')),
    Field('state_id',db.state, default=1, label=T('Status')),
    Field('company','string', length=75, default='', label=T('Firma')),
    Field('email','string', length=128, default='', label=T('E-Mail'), 
unique=True),
    format='%(email)s',
    migrate=True) 

This results in mysql (show create table testcustomer):
| testcustomer | CREATE TABLE `testcustomer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country2` varchar(2) DEFAULT NULL,
  `language2` varchar(2) DEFAULT NULL,
  `state_id` int(11) DEFAULT NULL,
  `company` varchar(75) DEFAULT NULL,
  `email` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 |

As you can see, default does not get set in mysql as defined in db.py.
What could be the cause?
Also I wonder why auto_increment is set to "2" instead of "1"?

Thank you and kind regards
Fritz

-- 



Reply via email to