I use sqlite as db Yesterday i had to alter a column (apt_medicaval) to remove not null contraint. I used sqliteman to do it.The side effect is that it changed also the id. Stupid software!!!
I noticed now when i go to sqliteman, the id field is set as follows CREATE TABLE trabalhador ( * "id" INTEGER,* "empresa" INTEGER, "nome" CHAR(512), "foto" CHAR(512), "bi" CHAR(512), "ncart" CHAR(512), "ncartval" DATE NOT NULL, "apt_medica" CHAR(512), "apt_medicaval" DATE, "val_formacao" DATE, "rfid" CHAR(512), "obs" TEXT, "area" CHAR(512), "notify_responsible" CHAR(1), "notify_auditor" CHAR(1), "anual" CHAR(1), "residente" CHAR(1) ) the id shoud be set as id INTEGER PRIMARY KEY AUTOINCREMENT, now i dont know how to revert it Any ideas? regards 2014-05-16 17:37 GMT+01:00 António Ramos <ramstei...@gmail.com>: > Mayday, mayday, > > I have a "bug" in my app. > > Sudenly i detect records with no id set > > i go to admin to create one record in the "buggy" table and the id is not > set. > > All other tables are fine > > just in case , my model > > db.define_table('trabalhador', > > Field('empresa',db.empresa,readable=True,writable=False,label="Empresa",default=getempreiteiroid), > Field('nome','string',label="Nome do Trabalhador",required=True), > Field('foto','upload',autodelete=True,label="Foto"), > Field('bi','string',label="BI",required=True), > Field('ncart','string',label="Número do cartão",default="000"), > Field('ncartval','date',label="Validade do > cartão",default=request.now), > > Field('apt_medica','upload',autodelete=True,required=False,uploadfolder=os.path.join(request.folder,'uploads'),label='Ficha > de aptidão médica'), > Field('apt_medicaval','date',label='Validade da aptidão médica'), > Field('val_formacao','date',label='Validade da formação'), > Field('rfid','string',default="",label="RFID"), > Field('area','string'), > Field('notify_auditor','boolean',default=False,label="Notificar > auditores"), > Field('notify_responsible','boolean',default=False,label='Notificar > responsável'), > Field('obs','text',label="Obs."), > Field('anual','boolean',default=False,label="anual"), > Field('residente','boolean',default=False,label="Residente"), > format='%(nome)s' > ) > # -requires > db.trabalhador.bi.requires=[IS_NOT_EMPTY(error_message="Por favor indique > o BI")] > db.trabalhador.area.requires=IS_EMPTY_OR(IS_IN_SET(areas)) > #db.trabalhador.empresa.requires=IS_IN_DB(db, 'auth_user.id > ','empresa.empresa',error_message=e_m['not_in_db']) > db.trabalhador.nome.requires=[IS_NOT_EMPTY(error_message="Por favor > escreva o nome completo")] > > #if request.function=='trabalhador': > # if (not(request.args)): > # if int(request.vars.id)!=19: > db.trabalhador.apt_medica.requires=[IS_NOT_EMPTY(error_message="Por favor > anexe a aptidão médica")] > db.trabalhador.apt_medicaval.requires=[IS_NOT_EMPTY(error_message="Por > favor indique a validade da aptidão > médica"),IS_DATE(format=T('%Y/%m/%d'),error_message=T("Formato pretendido > aaa/mm/dd"))] > > > db.trabalhador.rfid.requires=IS_LENGTH(11) > > > Again i appreciate any help. > > Regards > António > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.