Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'disabled_utc' should be defined with the rest of the database fields #116

Closed
tjlevel12 opened this issue Aug 27, 2020 · 1 comment
Closed
Assignees

Comments

@tjlevel12
Copy link
Contributor

Right now, disabled_utc is defined after a number of hybrid properties, which is a non-obvious location. If there's no reason for it to be down there, can we move it up with the other database fields?

@is_disabled_by_date.expression
def is_disabled_by_date(cls):
is_disabled_expr = sa.sql.and_(
cls.disabled_utc.isnot(None),
cls.disabled_utc <= arrow.utcnow(),
)
return sa_sql.case([(is_disabled_expr, sa.true())], else_=sa.false())
# The datetime when a user will be disabled. User will be inactive if this is set
# to a datetime in the past.
disabled_utc = sa.Column(ArrowType, nullable=True, default=None, server_default=sa.null())

@rsyring
Copy link
Member

rsyring commented Aug 27, 2020

Also, is there any reason server_default is set explicitly to NULL? That should be the default.

@guruofgentoo guruofgentoo self-assigned this Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants