schema changes, part #1
This commit is contained in:
parent
b5112c6565
commit
7a60f50b3a
8 changed files with 311 additions and 95 deletions
86
alembic/versions/ae0587e14725_.py
Normal file
86
alembic/versions/ae0587e14725_.py
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
"""empty message
|
||||
|
||||
Sorry, due to unattended changes, upgrade from 1.0.0 is not possible. Sorry.
|
||||
|
||||
Revision ID: ae0587e14725
|
||||
Revises:
|
||||
Create Date: 2025-10-04 09:43:41.158057
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'ae0587e14725'
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
#op.drop_index('pagepolicykey_passphrase_sec_code', table_name='pagepolicykey')
|
||||
#op.drop_index('page_owner', table_name='page')
|
||||
op.create_index(op.f('ix_page_calendar'), 'page', ['calendar'], unique=False)
|
||||
op.create_index('page_calendar', 'page', ['calendar'], unique=False)
|
||||
op.drop_index('user_id', table_name='usergroupmembership')
|
||||
op.drop_index('user_id_2', table_name='usergroupmembership')
|
||||
#op.drop_index('usergroupmembership_group_id', table_name='usergroupmembership')
|
||||
#op.drop_index('usergroupmembership_user_id', table_name='usergroupmembership')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index('usergroupmembership_user_id', 'usergroupmembership', ['user_id'], unique=False)
|
||||
op.create_index('usergroupmembership_group_id', 'usergroupmembership', ['group_id'], unique=False)
|
||||
op.create_index('user_id_2', 'usergroupmembership', ['user_id', 'group_id'], unique=True)
|
||||
op.create_index('user_id', 'usergroupmembership', ['user_id', 'group_id'], unique=True)
|
||||
op.drop_index('page_calendar', table_name='page')
|
||||
op.drop_index(op.f('ix_page_calendar'), table_name='page')
|
||||
op.create_index('page_owner', 'page', ['owner_id'], unique=False)
|
||||
op.create_table('upload',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('name', mysql.VARCHAR(length=256), nullable=False),
|
||||
sa.Column('url_name', mysql.VARCHAR(length=256), nullable=True),
|
||||
sa.Column('filetype', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('filesize', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('upload_date', mysql.DATETIME(), nullable=False),
|
||||
sa.Column('md5', mysql.VARCHAR(length=32), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mariadb_collate='utf8mb4_general_ci',
|
||||
mariadb_default_charset='utf8mb4',
|
||||
mariadb_engine='InnoDB'
|
||||
)
|
||||
op.create_index('upload_upload_date', 'upload', ['upload_date'], unique=False)
|
||||
op.create_index('upload_md5', 'upload', ['md5'], unique=False)
|
||||
op.create_table('pagepolicy',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('page_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
|
||||
sa.Column('type', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('key_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('sitewide', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['key_id'], ['pagepolicykey.id'], name='pagepolicy_FK_0_0'),
|
||||
sa.ForeignKeyConstraint(['page_id'], ['page.id'], name='pagepolicy_FK_1_0'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mariadb_collate='utf8mb4_general_ci',
|
||||
mariadb_default_charset='utf8mb4',
|
||||
mariadb_engine='InnoDB'
|
||||
)
|
||||
op.create_index('pagepolicy_page_id_key_id', 'pagepolicy', ['page_id', 'key_id'], unique=True)
|
||||
op.create_index('pagepolicy_page_id', 'pagepolicy', ['page_id'], unique=False)
|
||||
op.create_index('pagepolicy_key_id', 'pagepolicy', ['key_id'], unique=False)
|
||||
op.create_table('pagepolicykey',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('passphrase', mysql.VARCHAR(length=255), nullable=False),
|
||||
sa.Column('sec_code', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mariadb_collate='utf8mb4_general_ci',
|
||||
mariadb_default_charset='utf8mb4',
|
||||
mariadb_engine='InnoDB'
|
||||
)
|
||||
op.create_index('pagepolicykey_passphrase_sec_code', 'pagepolicykey', ['passphrase', 'sec_code'], unique=True)
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue