mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
72 lines
3.1 KiB
Python
72 lines
3.1 KiB
Python
|
"""wikis
|
||
|
|
||
|
Revision ID: b97584a7a10b
|
||
|
Revises: ea5a07acf23c
|
||
|
Create Date: 2024-07-17 20:54:20.626562
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'b97584a7a10b'
|
||
|
down_revision = 'ea5a07acf23c'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('community_wiki_page',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('community_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('slug', sa.String(length=100), nullable=True),
|
||
|
sa.Column('title', sa.String(length=255), nullable=True),
|
||
|
sa.Column('body', sa.Text(), nullable=True),
|
||
|
sa.Column('body_html', sa.Text(), nullable=True),
|
||
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||
|
sa.Column('edited_at', sa.DateTime(), nullable=True),
|
||
|
sa.Column('who_can_edit', sa.Integer(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['community_id'], ['community.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
with op.batch_alter_table('community_wiki_page', schema=None) as batch_op:
|
||
|
batch_op.create_index(batch_op.f('ix_community_wiki_page_community_id'), ['community_id'], unique=False)
|
||
|
batch_op.create_index(batch_op.f('ix_community_wiki_page_slug'), ['slug'], unique=False)
|
||
|
|
||
|
op.create_table('community_wiki_page_revision',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('wiki_page_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('community_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('title', sa.String(length=255), nullable=True),
|
||
|
sa.Column('body', sa.Text(), nullable=True),
|
||
|
sa.Column('body_html', sa.Text(), nullable=True),
|
||
|
sa.Column('edited_at', sa.DateTime(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['community_id'], ['community.id'], ),
|
||
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||
|
sa.ForeignKeyConstraint(['wiki_page_id'], ['community_wiki_page.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
with op.batch_alter_table('community_wiki_page_revision', schema=None) as batch_op:
|
||
|
batch_op.create_index(batch_op.f('ix_community_wiki_page_revision_community_id'), ['community_id'], unique=False)
|
||
|
batch_op.create_index(batch_op.f('ix_community_wiki_page_revision_wiki_page_id'), ['wiki_page_id'], unique=False)
|
||
|
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
with op.batch_alter_table('community_wiki_page_revision', schema=None) as batch_op:
|
||
|
batch_op.drop_index(batch_op.f('ix_community_wiki_page_revision_wiki_page_id'))
|
||
|
batch_op.drop_index(batch_op.f('ix_community_wiki_page_revision_community_id'))
|
||
|
|
||
|
op.drop_table('community_wiki_page_revision')
|
||
|
with op.batch_alter_table('community_wiki_page', schema=None) as batch_op:
|
||
|
batch_op.drop_index(batch_op.f('ix_community_wiki_page_slug'))
|
||
|
batch_op.drop_index(batch_op.f('ix_community_wiki_page_community_id'))
|
||
|
|
||
|
op.drop_table('community_wiki_page')
|
||
|
# ### end Alembic commands ###
|