Just delete the files in your databases directory.

Recreate the tables with the constraints in place and you should be good to 
go.

Adding notnull an unique constraints to a table can be problematic. The 
online manual contains a section about database migration gotchas, which I 
would recommend you read.

On Wednesday, December 18, 2013 9:21:07 PM UTC-5, deepak sandhu wrote:
>
> i made 2 tables in web2py:
> # coding: utf8
>
>
>
> db.define_table('dept',
>
>                 Field('name',unique=True))
>
>
>
>
> db.define_table('course',
>
>                 Field('d_id','reference d'),
>
>                 Field('name',unique=True))
>
>
>
> then I added some data in them from appadmin. 
> after that I modified the field names of tables since then I am getting 
> errors I can't even see the index page of my application this is the error 
> I get :
>
> 27.0.0.1.2013-12-18.20-14-40.b01e8090-535c-4796-975b-7dd5faa71631
> <class 'sqlite3.OperationalError'> Cannot add a UNIQUE column
>
> I was thinking of dropping the tables might solve the problem but in when 
> I open shell it also doest run any commands and keep telling to refresh the 
> page and try again?
> how can I empty the database so I can keep working? 
> I can put the previous definitions of table and fields but I don't 
> remember exactly what I wrote there when I first defined them.
>
> on removing the unique it works but i dont understand what's the problem 
> with unique? how can i make it working with unique = True
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to