56 lines
2.5 KiB
Python
56 lines
2.5 KiB
Python
"""permissions and solar stuff
|
|
|
|
Revision ID: 7d6db184b8fc
|
|
Revises: c6edf87b8bff
|
|
Create Date: 2021-05-18 13:49:37.642465
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '7d6db184b8fc'
|
|
down_revision = 'c6edf87b8bff'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.rename_table('stamps', 'stamps_solar')
|
|
op.drop_column('upload_solar', 'corpus_name')
|
|
op.create_table('corpus_access',
|
|
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('corpus_access_id_seq'::regclass)"), autoincrement=True, nullable=False),
|
|
sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('corpus', sa.TEXT(), autoincrement=False, nullable=False),
|
|
sa.ForeignKeyConstraint(['user_id'], ['registered_user.id'], name='user_id_fkey'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('contracts_solar',
|
|
sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('contracts_solar_id_seq'::regclass)"), autoincrement=True, nullable=False),
|
|
sa.Column('institution', sa.INTEGER(), autoincrement=False, nullable=False),
|
|
sa.Column('upload_user', sa.INTEGER(), autoincrement=False, nullable=True),
|
|
sa.Column('timestamp', sa.DateTime(), nullable=False),
|
|
sa.Column('file_contract', sa.TEXT(), autoincrement=False, nullable=False),
|
|
sa.Column('contract_type', sa.TEXT(), autoincrement=False, nullable=False),
|
|
sa.ForeignKeyConstraint(['institution'], ['institution.id'], name='institution_fkey'),
|
|
sa.ForeignKeyConstraint(['upload_user'], ['registered_user.id'], name='upload_user_fkey'),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.add_column('registered_user', sa.Column('institution_moderator', sa.BOOLEAN(), autoincrement=False, default=False))
|
|
op.add_column('upload_predavanja', sa.Column('agree_publish_future', sa.TEXT(), nullable=False))
|
|
op.add_column('upload_predavanja', sa.Column('agree_machine_translation', sa.BOOLEAN(), nullable=False))
|
|
op.add_column('upload_predavanja', sa.Column('agree_news_cjvt', sa.BOOLEAN(), nullable=False))
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('upload_solar', sa.Column('corpus_name', sa.TEXT(), autoincrement=False, nullable=False))
|
|
op.rename_table('stamps_solar', 'stamps')
|
|
op.drop_table('corpus_access')
|
|
op.drop_table('contracts_solar')
|
|
op.drop_column('registered_user', 'institution_moderator')
|
|
# ### end Alembic commands ###
|