888e445 Use a validator to keep the model in consistent with the alembic migration

Authored and Committed by pingou 7 years ago
    Use a validator to keep the model in consistent with the alembic migration
    
    This way we ensure the token_id cannot be null in the software level
    since we cannot do that at the DB level.
    
    We cannot do it at the DB level since for existing entries in the DB we
    cannot find back what was the token_id. So there are two ways:
    - have the model define nullable=False and the migration nullable=True
    - be consistent between the model and the migration and enforce
      nullable=False for new entries in the software.
    
    This commit applies the second option.
    
        
file modified
+7 -1
file modified
+29 -0