title: Web2Py: How do you stop deletion of referenced tables?
body: <p>I am designing an app which keeps track of user data by making backups of it every time it is saved so that they can revert to old versions. This is how I have the table definitions set up:</p>
  
  <pre><code>db.define_table('Menu',
    Field('title', 'string', unique=True),
    Field('ver', 'float', readable=False, writable=False),
    Field('menu', 'text', requires=IS_NOT_EMPTY()),
    format='%(title)s'
  )
  db.define_table('Backups',
    Field('menu_ref', 'reference Menus', ondelete='SET NULL'),
    Field('title', 'string'),
    Field('ver', 'float'),
    Field('date_ref', 'datetime', default=datetime.utcnow(), readable=False, writable=False, label='Date'),
    Field('menu', 'text'),
    Field('user_ref', 'reference auth_user', default=auth.user_id, writable=False, readable=False),
    format='%(menu_ref.title)s'+' v.%(ver)s'
  )
  </code></pre>
  
  <p>I'm having a problem where every time a menu is deleted it removes all of the backups that referenced it as well. I saw that the standard way to fix this is by setting the ondelete parameter to 'SET NULL' but that didn't work. I've also tried changing the type of menu_ref in Backups to 'integer' and just having it reference the right id in Menu, but it still deletes all related rows for some reason. Does anybody know how you're supposed to stop this?</p>
  
  <p>I'm using SQL Lite right now to test my application but it will be moved to Google App Engine later if that is relevant.</p>
  
  <p>Thanks ahead of time.</p>