Mercurial > libervia-backend
view sat/memory/migration/versions/8974efc51d22_create_tables_for_pubsub_caching.py @ 3816:213e83a4ed10
plugin identity, XEP-0054: move avatar resizing and caching method to identity plugin:
resizing and caching is now done in identity plugin, to prepare for the implementation of
other XEP to handle avatars.
rel 368
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Jun 2022 11:47:48 +0200 |
parents | d5116197e403 |
children |
line wrap: on
line source
"""create tables for Pubsub caching Revision ID: 8974efc51d22 Revises: 602caf848068 Create Date: 2021-07-27 16:38:54.658212 """ from alembic import op import sqlalchemy as sa from sat.memory.sqla_mapping import JID, Xml # revision identifiers, used by Alembic. revision = '8974efc51d22' down_revision = '602caf848068' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('pubsub_nodes', sa.Column('id', sa.Integer(), nullable=False), sa.Column('profile_id', sa.Integer(), nullable=True), sa.Column('service', JID(), nullable=True), sa.Column('name', sa.Text(), nullable=False), sa.Column('subscribed', sa.Boolean(create_constraint=True, name='subscribed_bool'), nullable=False), sa.Column('analyser', sa.Text(), nullable=True), sa.Column('sync_state', sa.Enum('IN_PROGRESS', 'COMPLETED', 'ERROR', 'NO_SYNC', name='sync_state', create_constraint=True), nullable=True), sa.Column('sync_state_updated', sa.Float(), nullable=False), sa.Column('type', sa.Text(), nullable=True), sa.Column('subtype', sa.Text(), nullable=True), sa.Column('extra', sa.JSON(), nullable=True), sa.ForeignKeyConstraint(['profile_id'], ['profiles.id'], name=op.f('fk_pubsub_nodes_profile_id_profiles'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('pk_pubsub_nodes')), sa.UniqueConstraint('profile_id', 'service', 'name', name=op.f('uq_pubsub_nodes_profile_id')) ) op.create_table('pubsub_items', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('name', sa.Text(), nullable=False), sa.Column('data', Xml(), nullable=False), sa.Column('created', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.Column('updated', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False), sa.Column('parsed', sa.JSON(), nullable=True), sa.ForeignKeyConstraint(['node_id'], ['pubsub_nodes.id'], name=op.f('fk_pubsub_items_node_id_pubsub_nodes'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('pk_pubsub_items')), sa.UniqueConstraint('node_id', 'name', name=op.f('uq_pubsub_items_node_id')) ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('pubsub_items') op.drop_table('pubsub_nodes') # ### end Alembic commands ###