default next_delete to null
This commit is contained in:
parent
c897edf294
commit
8ab74eb306
|
@ -0,0 +1,26 @@
|
||||||
|
"""default next_delete to null
|
||||||
|
|
||||||
|
Revision ID: 41ef02e66382
|
||||||
|
Revises: f95af1a8d89f
|
||||||
|
Create Date: 2017-08-31 21:19:44.304952
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '41ef02e66382'
|
||||||
|
down_revision = 'f95af1a8d89f'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column('accounts', 'next_delete', server_default=None)
|
||||||
|
op.execute("UPDATE accounts SET next_delete = NULL where next_delete = 'epoch';")
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.alter_column('accounts', 'next_delete', server_default='epoch')
|
||||||
|
op.execute("UPDATE accounts SET next_delete = 'epoch' where next_delete IS NULL;")
|
7
model.py
7
model.py
|
@ -97,10 +97,8 @@ class Account(TimestampMixin, RemoteIDMixin):
|
||||||
server_default='epoch', index=True)
|
server_default='epoch', index=True)
|
||||||
last_refresh = db.Column(db.DateTime(timezone=True),
|
last_refresh = db.Column(db.DateTime(timezone=True),
|
||||||
server_default='epoch', index=True)
|
server_default='epoch', index=True)
|
||||||
last_delete = db.Column(db.DateTime(timezone=True),
|
last_delete = db.Column(db.DateTime(timezone=True), index=True)
|
||||||
index=True)
|
next_delete = db.Column(db.DateTime(timezone=True), index=True)
|
||||||
next_delete = db.Column(db.DateTime(timezone=True),
|
|
||||||
server_default='epoch', index=True)
|
|
||||||
|
|
||||||
def touch_fetch(self):
|
def touch_fetch(self):
|
||||||
self.last_fetch = db.func.now()
|
self.last_fetch = db.func.now()
|
||||||
|
@ -142,7 +140,6 @@ class Account(TimestampMixin, RemoteIDMixin):
|
||||||
datetime.now(timezone.utc) + self.policy_delete_every)
|
datetime.now(timezone.utc) + self.policy_delete_every)
|
||||||
return enable
|
return enable
|
||||||
|
|
||||||
|
|
||||||
# backref: tokens
|
# backref: tokens
|
||||||
# backref: twitter_archives
|
# backref: twitter_archives
|
||||||
# backref: posts
|
# backref: posts
|
||||||
|
|
Loading…
Reference in New Issue