Did you check if there is record with empty username? If you try to add not
null over a column/table that is not empty it may happen that some
record(s) don't respect the new rule so your constraint can't be apply...
You need to first update your records make sure none are empty than try
again the migration...

On Tue, Apr 19, 2016 at 6:40 AM, Emmanuel Dsouza <[email protected]>
wrote:

> adding the field:   Field('username', requires=IS_NOT_EMPTY(),
> unique=True)   gives me the following error:
>
> <class 'sqlite3.OperationalError'> Cannot add a UNIQUE column
>
> How to avoid this error?
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to