mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-19 21:24:27 +00:00
49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
|
"""Improved Webmentions
|
||
|
|
||
|
Revision ID: fd23d95e5c16
|
||
|
Revises: 69ce9fbdc483
|
||
|
Create Date: 2022-07-14 16:10:54.202455
|
||
|
|
||
|
"""
|
||
|
import sqlalchemy as sa
|
||
|
from sqlalchemy.dialects import sqlite
|
||
|
|
||
|
from alembic import op
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'fd23d95e5c16'
|
||
|
down_revision = '69ce9fbdc483'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade() -> None:
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('webmention',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||
|
sa.Column('is_deleted', sa.Boolean(), nullable=False),
|
||
|
sa.Column('source', sa.String(), nullable=False),
|
||
|
sa.Column('source_microformats', sa.JSON(), nullable=True),
|
||
|
sa.Column('target', sa.String(), nullable=False),
|
||
|
sa.Column('outbox_object_id', sa.Integer(), nullable=False),
|
||
|
sa.ForeignKeyConstraint(['outbox_object_id'], ['outbox.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id'),
|
||
|
sa.UniqueConstraint('source', 'target', name='uix_source_target')
|
||
|
)
|
||
|
op.create_index(op.f('ix_webmention_id'), 'webmention', ['id'], unique=False)
|
||
|
op.create_index(op.f('ix_webmention_source'), 'webmention', ['source'], unique=True)
|
||
|
op.create_index(op.f('ix_webmention_target'), 'webmention', ['target'], unique=False)
|
||
|
op.drop_column('outbox', 'webmentions')
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade() -> None:
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.add_column('outbox', sa.Column('webmentions', sqlite.JSON(), nullable=True))
|
||
|
op.drop_index(op.f('ix_webmention_target'), table_name='webmention')
|
||
|
op.drop_index(op.f('ix_webmention_source'), table_name='webmention')
|
||
|
op.drop_index(op.f('ix_webmention_id'), table_name='webmention')
|
||
|
op.drop_table('webmention')
|
||
|
# ### end Alembic commands ###
|