mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
post vote effect index
This commit is contained in:
parent
a29a914bf0
commit
0fa8c674b2
2 changed files with 33 additions and 1 deletions
|
@ -835,7 +835,7 @@ class PostVote(db.Model):
|
|||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
||||
author_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
||||
post_id = db.Column(db.Integer, db.ForeignKey('post.id'))
|
||||
effect = db.Column(db.Float)
|
||||
effect = db.Column(db.Float, index=True)
|
||||
created_at = db.Column(db.DateTime, default=utcnow)
|
||||
post = db.relationship('Post', foreign_keys=[post_id])
|
||||
|
||||
|
|
32
migrations/versions/aaf434e9e7bf_post_vote_index.py
Normal file
32
migrations/versions/aaf434e9e7bf_post_vote_index.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
"""post vote index
|
||||
|
||||
Revision ID: aaf434e9e7bf
|
||||
Revises: 5b4a967f9988
|
||||
Create Date: 2024-01-10 10:17:47.397781
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'aaf434e9e7bf'
|
||||
down_revision = '5b4a967f9988'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('post_vote', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_post_vote_effect'), ['effect'], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('post_vote', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_post_vote_effect'))
|
||||
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue