mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
adding intercted_at column to read_posts table
This commit is contained in:
parent
42df0fe458
commit
9185a56267
2 changed files with 35 additions and 0 deletions
|
@ -617,6 +617,7 @@ user_role = db.Table('user_role',
|
||||||
read_posts = db.Table('read_posts',
|
read_posts = db.Table('read_posts',
|
||||||
db.Column('user_id', db.Integer, db.ForeignKey('user.id'), index=True),
|
db.Column('user_id', db.Integer, db.ForeignKey('user.id'), index=True),
|
||||||
db.Column('read_post_id', db.Integer, db.ForeignKey('post.id'), index=True),
|
db.Column('read_post_id', db.Integer, db.ForeignKey('post.id'), index=True),
|
||||||
|
db.Column('interacted_at', db.DateTime, index=True, default=utcnow) # this is when the content is interacte with
|
||||||
)
|
)
|
||||||
|
|
||||||
class User(UserMixin, db.Model):
|
class User(UserMixin, db.Model):
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
"""adding created_at to read_posts table
|
||||||
|
|
||||||
|
Revision ID: 238d7c60d676
|
||||||
|
Revises: 6e0b98e1fdc6
|
||||||
|
Create Date: 2024-09-28 09:26:22.000646
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '238d7c60d676'
|
||||||
|
down_revision = '6e0b98e1fdc6'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('read_posts', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('interacted_at', sa.DateTime(), nullable=True))
|
||||||
|
batch_op.create_index(batch_op.f('ix_read_posts_interacted_at'), ['interacted_at'], unique=False)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('read_posts', schema=None) as batch_op:
|
||||||
|
batch_op.drop_index(batch_op.f('ix_read_posts_interacted_at'))
|
||||||
|
batch_op.drop_column('interacted_at')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue