Advertisement
Guest User

Untitled

a guest
Jun 8th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class User(TableMixin, Base):
  2. username = Column(String, nullable=False, unique=False)
  3. password = Column(String, nullable=False, unique=False)
  4.  
  5. class BBTableMixin(BBTableBaseMixin):
  6. id = Column(Integer, primary_key=True)
  7. active = Column(Boolean, nullable=False, default=True)
  8.  
  9. CREATE UNIQUE INDEX unique_active_username on user (username, active)
  10. where active = True;
  11.  
  12. Index('ix_active_username', "active", username,
  13. unique=True,
  14. postgresql_where=("active" is True)
  15. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement