mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Upgrade DB for cross_posts field
This commit is contained in:
parent
7f6cd31ccc
commit
16996e3a20
2 changed files with 35 additions and 0 deletions
|
@ -10,6 +10,8 @@ from werkzeug.security import generate_password_hash, check_password_hash
|
|||
from flask_babel import _, lazy_gettext as _l
|
||||
from sqlalchemy.orm import backref
|
||||
from sqlalchemy_utils.types import TSVectorType # https://sqlalchemy-searchable.readthedocs.io/en/latest/installation.html
|
||||
from sqlalchemy.dialects.postgresql import ARRAY
|
||||
from sqlalchemy.ext.mutable import MutableList
|
||||
from flask_sqlalchemy import BaseQuery
|
||||
from sqlalchemy_searchable import SearchQueryMixin
|
||||
from app import db, login, cache, celery
|
||||
|
@ -869,6 +871,7 @@ class Post(db.Model):
|
|||
language = db.Column(db.String(10))
|
||||
edited_at = db.Column(db.DateTime)
|
||||
reports = db.Column(db.Integer, default=0) # how many times this post has been reported. Set to -1 to ignore reports
|
||||
cross_posts = db.Column(MutableList.as_mutable(ARRAY(db.Integer)))
|
||||
|
||||
ap_id = db.Column(db.String(255), index=True)
|
||||
ap_create_id = db.Column(db.String(100))
|
||||
|
|
32
migrations/versions/08b3f718df5d_cross_posts.py
Normal file
32
migrations/versions/08b3f718df5d_cross_posts.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
"""cross posts
|
||||
|
||||
Revision ID: 08b3f718df5d
|
||||
Revises: 04697ae91fac
|
||||
Create Date: 2024-03-31 02:10:19.726154
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '08b3f718df5d'
|
||||
down_revision = '04697ae91fac'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('post', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('cross_posts', postgresql.ARRAY(sa.Integer()), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('post', schema=None) as batch_op:
|
||||
batch_op.drop_column('cross_posts')
|
||||
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue