remove problematic database index

This commit is contained in:
rimu 2024-01-04 16:09:22 +13:00
parent 781694e023
commit 5948650b3a
2 changed files with 2 additions and 8 deletions

View file

@ -57,9 +57,9 @@ class Instance(db.Model):
last_successful_send = db.Column(db.DateTime) # When we successfully sent them an Activity
failures = db.Column(db.Integer, default=0) # How many times we failed to send (reset to 0 after every successful send)
most_recent_attempt = db.Column(db.DateTime) # When the most recent failure was
dormant = db.Column(db.Boolean, default=False, index=True) # True once this instance is considered offline and not worth sending to any more
dormant = db.Column(db.Boolean, default=False) # True once this instance is considered offline and not worth sending to any more
start_trying_again = db.Column(db.DateTime) # When to start trying again. Should grow exponentially with each failure.
gone_forever = db.Column(db.Boolean, default=False, index=True) # True once this instance is considered offline forever - never start trying again
gone_forever = db.Column(db.Boolean, default=False) # True once this instance is considered offline forever - never start trying again
ip_address = db.Column(db.String(50))
posts = db.relationship('Post', backref='instance', lazy='dynamic')

View file

@ -29,18 +29,12 @@ def upgrade():
batch_op.create_index(batch_op.f('ix_community_topic_id'), ['topic_id'], unique=False)
batch_op.create_foreign_key(None, 'topic', ['topic_id'], ['id'])
with op.batch_alter_table('instance', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_instance_dormant'), ['dormant'], unique=False)
batch_op.create_index(batch_op.f('ix_instance_gone_forever'), ['gone_forever'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('instance', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_instance_gone_forever'))
batch_op.drop_index(batch_op.f('ix_instance_dormant'))
with op.batch_alter_table('community', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')