I think the problem is that you have a notnull column without default.
This causes a problem when doing a migration.


On Nov 25, 9:13 am, annet <[EMAIL PROTECTED]> wrote:
> The following lines of code are part of my model:
>
> db.define_table('sleutelwoord',
>     SQLField('woord', length=20, notnull=True, unique=True),
>     SQLField('verzameling', type='integer', length=1, notnull=True,
> unique=True),
>     migrate='sleutelwoord.table')
>
> db.define_table('event',
>     SQLField('bedrijf', db.bedrijf, notnull=True),
>     SQLField('event', length=50, notnull=True),
>     SQLField('vandatum', type='date', notnull=True,),
>     SQLField('totdatum', type='date', notnull=True),
>     SQLField('duur', length=10, notnull=True),
>     SQLField('plaatsnaam', length=40, notnull=True),
>     SQLField('locatie', length=50),
>     SQLField('omschrijving', type='text'),
>     SQLField('sleutelwoord', db.sleutelwoord, notnull=True,
> ondelete='RESTRICT'),
>     SQLField('doelgroep', db.doelgroep, notnull=True,
> ondelete='RESTRICT'),
>     SQLField('scope', db.scope, notnull=True, ondelete='RESTRICT'),
>     migrate='event.table')
>
> db.event.sleutelwoord.requires=IS_IN_DB(db, 'sleutelwoord.id', '%
> (woord)s')
>
> When I removed the unique=True constraint from the sleutelwoord tabel
> and saved the model, it raised the following error:
>
> S'Traceback (most recent call last):\n  File "/Library/Python/2.5/site-
> packages/web2py/gluon/restricted.py", line 62, in restricted\n    exec
> ccode in environment\n  File "/Library/Python/2.5/site-packages/web2py/
> applications/b2c/models/db.py", line 147, in <module>\n    migrate=
> \'sleutelwoord.table\')\n  File "/Library/Python/2.5/site-packages/
> web2py/gluon/sql.py", line 558, in define_table\n    raise e
> \nIntegrityError: column "verzameling__tmp" contains null values
>
> At the moment the error was raised, the table contained one record:
>
> values: 1,event,2
>
> so no null values, as far as I can judge. Since I have experienced
> this problem a couple of times before, I consider it worth a post.
>
> This brings me to one of my greatest worries, I am working with web2py
> and postgres on Mac OS 10.5.4 and every now and then the DAL got me
> confused, simple changes like the one above raise errors I do not
> understand. My postgres database contains example records for
> development purposes, so it is no big deal to drop and re-create some
> tables every now and then. But what when these errors occur after
> deployment on a production server.
>
> After initial deployment, when I continue developing my application,
> the database in my development environment will start to differ from
> the one on the production server. When I redeploy my application on
> the production server, the files that make up the model match my
> development database, but not my production database. How does web2py
> deal with these differences?
>
> I hope one of you can reassure me.
>
> Best regards,
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to