mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Add parallel fs changes to migration scripts and cleanup
This commit is contained in:
parent
cbf3abb424
commit
0b656d3cf1
@ -17,25 +17,22 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
op.create_table(
|
||||||
op.create_table('tokens',
|
'tokens',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('access_token', sa.String(length=64), nullable=True),
|
sa.Column('access_token', sa.String(length=64), nullable=True),
|
||||||
sa.Column('access_expiration', sa.DateTime(), nullable=True),
|
sa.Column('access_expiration', sa.DateTime(), nullable=True),
|
||||||
sa.Column('refresh_token', sa.String(length=64), nullable=True),
|
sa.Column('refresh_token', sa.String(length=64), nullable=True),
|
||||||
sa.Column('refresh_expiration', sa.DateTime(), nullable=True),
|
sa.Column('refresh_expiration', sa.DateTime(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_index(op.f('ix_tokens_access_token'), 'tokens', ['access_token'], unique=False)
|
op.create_index(op.f('ix_tokens_access_token'), 'tokens', ['access_token'], unique=False)
|
||||||
op.create_index(op.f('ix_tokens_refresh_token'), 'tokens', ['refresh_token'], unique=False)
|
op.create_index(op.f('ix_tokens_refresh_token'), 'tokens', ['refresh_token'], unique=False)
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_index(op.f('ix_tokens_refresh_token'), table_name='tokens')
|
op.drop_index(op.f('ix_tokens_refresh_token'), table_name='tokens')
|
||||||
op.drop_index(op.f('ix_tokens_access_token'), table_name='tokens')
|
op.drop_index(op.f('ix_tokens_access_token'), table_name='tokens')
|
||||||
op.drop_table('tokens')
|
op.drop_table('tokens')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -17,12 +17,10 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_column('transkribus_htr_models', 'transkribus_name')
|
op.drop_column('transkribus_htr_models', 'transkribus_name')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
op.add_column('transkribus_htr_models',
|
||||||
op.add_column('transkribus_htr_models', sa.Column('transkribus_name', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
|
sa.Column('transkribus_name', sa.String(length=64), autoincrement=False, nullable=True)
|
||||||
# ### end Alembic commands ###
|
)
|
||||||
|
@ -17,13 +17,12 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
op.add_column(
|
||||||
op.add_column('corpora', sa.Column('is_public', sa.Boolean(), nullable=True))
|
'corpora',
|
||||||
|
sa.Column('is_public', sa.Boolean(), nullable=True)
|
||||||
|
)
|
||||||
op.execute('UPDATE corpora SET is_public = false;')
|
op.execute('UPDATE corpora SET is_public = false;')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_column('corpora', 'is_public')
|
op.drop_column('corpora', 'is_public')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -20,34 +20,44 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
for user in User.query.all():
|
for user in User.query.all():
|
||||||
os.mkdir(os.path.join(user.path, 'spacy_nlp_pipeline_models'))
|
spacy_nlp_pipeline_models_dir = os.path.join(user.path, 'spacy_nlp_pipeline_models')
|
||||||
op.create_table('spacy_nlp_pipeline_models',
|
if os.path.exists(spacy_nlp_pipeline_models_dir):
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
if not os.path.isdir(spacy_nlp_pipeline_models_dir):
|
||||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
raise OSError(f'Not a directory: {spacy_nlp_pipeline_models_dir}')
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
if not os.listdir(spacy_nlp_pipeline_models_dir):
|
||||||
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
raise OSError(f'Directory not empty: {spacy_nlp_pipeline_models_dir}')
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
else:
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
os.mkdir(spacy_nlp_pipeline_models_dir)
|
||||||
sa.Column('title', sa.String(length=64), nullable=True),
|
|
||||||
sa.Column('description', sa.String(length=255), nullable=True),
|
|
||||||
sa.Column('version', sa.String(length=16), nullable=True),
|
op.create_table(
|
||||||
sa.Column('compatible_service_versions', sa.String(length=255), nullable=True),
|
'spacy_nlp_pipeline_models',
|
||||||
sa.Column('publisher', sa.String(length=128), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('publisher_url', sa.String(length=512), nullable=True),
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||||
sa.Column('publishing_url', sa.String(length=512), nullable=True),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||||||
sa.Column('shared', sa.Boolean(), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('title', sa.String(length=64), nullable=True),
|
||||||
|
sa.Column('description', sa.String(length=255), nullable=True),
|
||||||
|
sa.Column('version', sa.String(length=16), nullable=True),
|
||||||
|
sa.Column('compatible_service_versions', sa.String(length=255), nullable=True),
|
||||||
|
sa.Column('publisher', sa.String(length=128), nullable=True),
|
||||||
|
sa.Column('publisher_url', sa.String(length=512), nullable=True),
|
||||||
|
sa.Column('publishing_url', sa.String(length=512), nullable=True),
|
||||||
|
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('shared', sa.Boolean(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
for user in User.query.all():
|
for user in User.query.all():
|
||||||
shutil.rmtree(os.path.join(user.path, 'spacy_nlp_pipeline_models'))
|
spacy_nlp_pipeline_models_dir = os.path.join(user.path, 'spacy_nlp_pipeline_models')
|
||||||
|
if os.path.exists(spacy_nlp_pipeline_models_dir):
|
||||||
|
shutil.rmtree(spacy_nlp_pipeline_models_dir)
|
||||||
|
|
||||||
|
|
||||||
op.drop_table('spacy_nlp_pipeline_models')
|
op.drop_table('spacy_nlp_pipeline_models')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -5,8 +5,8 @@ Revises: 260b57d5f4e7
|
|||||||
Create Date: 2022-10-11 14:32:13.227364
|
Create Date: 2022-10-11 14:32:13.227364
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from genericpath import isdir
|
||||||
from alembic import op
|
from alembic import op
|
||||||
from flask import current_app
|
|
||||||
import os
|
import os
|
||||||
from app.models import User
|
from app.models import User
|
||||||
|
|
||||||
@ -18,40 +18,19 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
for user in User.query.all():
|
for user in User.query.all():
|
||||||
old_tesseract_ocr_pipeline_model_path = os.path.join(
|
old_tesseract_ocr_pipeline_model_path = os.path.join(user.path, 'tesseract_ocr_models')
|
||||||
user.path,
|
new_tesseract_ocr_pipeline_model_path = os.path.join(user.path, 'tesseract_ocr_pipeline_models')
|
||||||
'tesseract_ocr_models'
|
os.rename(old_tesseract_ocr_pipeline_model_path, new_tesseract_ocr_pipeline_model_path)
|
||||||
)
|
|
||||||
new_tesseract_ocr_pipeline_model_path = os.path.join(
|
|
||||||
user.path,
|
|
||||||
'tesseract_ocr_pipeline_models'
|
|
||||||
)
|
|
||||||
os.rename(
|
|
||||||
old_tesseract_ocr_pipeline_model_path,
|
|
||||||
new_tesseract_ocr_pipeline_model_path
|
|
||||||
)
|
|
||||||
op.rename_table('tesseract_ocr_models', 'tesseract_ocr_pipeline_models')
|
op.rename_table('tesseract_ocr_models', 'tesseract_ocr_pipeline_models')
|
||||||
op.rename_table('transkribus_htr_models', 'transkribus_htr_pipeline_models')
|
op.rename_table('transkribus_htr_models', 'transkribus_htr_pipeline_models')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
for user in User.query.all():
|
for user in User.query.all():
|
||||||
old_tesseract_ocr_pipeline_model_path = os.path.join(
|
old_tesseract_ocr_pipeline_model_path = os.path.join(user.path, 'tesseract_ocr_models')
|
||||||
user.path,
|
new_tesseract_ocr_pipeline_model_path = os.path.join(user.path, 'tesseract_ocr_pipeline_models')
|
||||||
'tesseract_ocr_models'
|
os.rename(old_tesseract_ocr_pipeline_model_path, new_tesseract_ocr_pipeline_model_path)
|
||||||
)
|
os.rename(new_tesseract_ocr_pipeline_model_path, old_tesseract_ocr_pipeline_model_path)
|
||||||
new_tesseract_ocr_pipeline_model_path = os.path.join(
|
|
||||||
user.path,
|
|
||||||
'tesseract_ocr_pipeline_models'
|
|
||||||
)
|
|
||||||
os.rename(
|
|
||||||
new_tesseract_ocr_pipeline_model_path,
|
|
||||||
old_tesseract_ocr_pipeline_model_path
|
|
||||||
)
|
|
||||||
op.rename_table('tesseract_ocr_pipeline_models', 'tesseract_ocr_models')
|
op.rename_table('tesseract_ocr_pipeline_models', 'tesseract_ocr_models')
|
||||||
op.rename_table('transkribus_htr_pipeline_models', 'transkribus_htr_models')
|
op.rename_table('transkribus_htr_pipeline_models', 'transkribus_htr_models')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -6,7 +6,10 @@ Create Date: 2022-04-22 09:38:49.527498
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
|
from flask import current_app
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
@ -17,138 +20,167 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
users_dir = os.path.join(current_app.config['NOPAQUE_DATA_DIR'], 'users')
|
||||||
op.create_table('roles',
|
if os.path.exists(users_dir):
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
if not os.path.isdir(users_dir):
|
||||||
sa.Column('default', sa.Boolean(), nullable=True),
|
raise OSError(f'Not a directory: {users_dir}')
|
||||||
sa.Column('name', sa.String(length=64), nullable=True),
|
if not os.listdir(users_dir):
|
||||||
sa.Column('permissions', sa.Integer(), nullable=True),
|
raise OSError(f'Directory not empty: {users_dir}')
|
||||||
sa.PrimaryKeyConstraint('id'),
|
else:
|
||||||
sa.UniqueConstraint('name')
|
os.mkdir(users_dir)
|
||||||
|
|
||||||
|
|
||||||
|
op.create_table(
|
||||||
|
'roles',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('default', sa.Boolean(), nullable=True),
|
||||||
|
sa.Column('name', sa.String(length=64), nullable=True),
|
||||||
|
sa.Column('permissions', sa.Integer(), nullable=True),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('name')
|
||||||
)
|
)
|
||||||
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
|
op.create_index(op.f('ix_roles_default'), 'roles', ['default'], unique=False)
|
||||||
op.create_table('users',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
op.create_table(
|
||||||
sa.Column('role_id', sa.Integer(), nullable=True),
|
'users',
|
||||||
sa.Column('confirmed', sa.Boolean(), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('email', sa.String(length=254), nullable=True),
|
sa.Column('role_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('last_seen', sa.DateTime(), nullable=True),
|
sa.Column('confirmed', sa.Boolean(), nullable=True),
|
||||||
sa.Column('member_since', sa.DateTime(), nullable=True),
|
sa.Column('email', sa.String(length=254), nullable=True),
|
||||||
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
sa.Column('last_seen', sa.DateTime(), nullable=True),
|
||||||
sa.Column('token', sa.String(length=32), nullable=True),
|
sa.Column('member_since', sa.DateTime(), nullable=True),
|
||||||
sa.Column('token_expiration', sa.DateTime(), nullable=True),
|
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
||||||
sa.Column('username', sa.String(length=64), nullable=True),
|
sa.Column('token', sa.String(length=32), nullable=True),
|
||||||
sa.Column('setting_dark_mode', sa.Boolean(), nullable=True),
|
sa.Column('token_expiration', sa.DateTime(), nullable=True),
|
||||||
sa.Column('setting_job_status_mail_notification_level', sa.Integer(), nullable=True),
|
sa.Column('username', sa.String(length=64), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
|
sa.Column('setting_dark_mode', sa.Boolean(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('setting_job_status_mail_notification_level', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
|
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
|
||||||
op.create_index(op.f('ix_users_token'), 'users', ['token'], unique=True)
|
op.create_index(op.f('ix_users_token'), 'users', ['token'], unique=True)
|
||||||
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
|
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
|
||||||
op.create_table('corpora',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
op.create_table(
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
'corpora',
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('description', sa.String(length=255), nullable=True),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('status', sa.Integer(), nullable=True),
|
sa.Column('description', sa.String(length=255), nullable=True),
|
||||||
sa.Column('title', sa.String(length=32), nullable=True),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('num_analysis_sessions', sa.Integer(), nullable=True),
|
sa.Column('status', sa.Integer(), nullable=True),
|
||||||
sa.Column('num_tokens', sa.Integer(), nullable=True),
|
sa.Column('title', sa.String(length=32), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.Column('num_analysis_sessions', sa.Integer(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('num_tokens', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('jobs',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
op.create_table(
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
'jobs',
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('description', sa.String(length=255), nullable=True),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('end_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('service', sa.String(length=64), nullable=True),
|
sa.Column('description', sa.String(length=255), nullable=True),
|
||||||
sa.Column('service_args', sa.String(length=255), nullable=True),
|
sa.Column('end_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('service_version', sa.String(length=16), nullable=True),
|
sa.Column('service', sa.String(length=64), nullable=True),
|
||||||
sa.Column('status', sa.Integer(), nullable=True),
|
sa.Column('service_args', sa.String(length=255), nullable=True),
|
||||||
sa.Column('title', sa.String(length=32), nullable=True),
|
sa.Column('service_version', sa.String(length=16), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.Column('status', sa.Integer(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('title', sa.String(length=32), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('tesseract_ocr_models',
|
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
op.create_table(
|
||||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
'tesseract_ocr_models',
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||||||
sa.Column('compatible_service_versions', sa.String(length=255), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('description', sa.String(length=255), nullable=True),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('publisher', sa.String(length=128), nullable=True),
|
sa.Column('compatible_service_versions', sa.String(length=255), nullable=True),
|
||||||
sa.Column('publisher_url', sa.String(length=512), nullable=True),
|
sa.Column('description', sa.String(length=255), nullable=True),
|
||||||
sa.Column('publishing_url', sa.String(length=512), nullable=True),
|
sa.Column('publisher', sa.String(length=128), nullable=True),
|
||||||
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
sa.Column('publisher_url', sa.String(length=512), nullable=True),
|
||||||
sa.Column('shared', sa.Boolean(), nullable=True),
|
sa.Column('publishing_url', sa.String(length=512), nullable=True),
|
||||||
sa.Column('title', sa.String(length=64), nullable=True),
|
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
||||||
sa.Column('version', sa.String(length=16), nullable=True),
|
sa.Column('shared', sa.Boolean(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.Column('title', sa.String(length=64), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('version', sa.String(length=16), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('transkribus_htr_models',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
op.create_table(
|
||||||
sa.Column('user_id', sa.Integer(), nullable=True),
|
'transkribus_htr_models',
|
||||||
sa.Column('shared', sa.Boolean(), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('transkribus_model_id', sa.Integer(), nullable=True),
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('transkribus_name', sa.String(length=64), nullable=True),
|
sa.Column('shared', sa.Boolean(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.Column('transkribus_model_id', sa.Integer(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('transkribus_name', sa.String(length=64), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('corpus_files',
|
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
op.create_table(
|
||||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
'corpus_files',
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('corpus_id', sa.Integer(), nullable=True),
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||||||
sa.Column('address', sa.String(length=255), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('author', sa.String(length=255), nullable=True),
|
sa.Column('corpus_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('booktitle', sa.String(length=255), nullable=True),
|
sa.Column('address', sa.String(length=255), nullable=True),
|
||||||
sa.Column('chapter', sa.String(length=255), nullable=True),
|
sa.Column('author', sa.String(length=255), nullable=True),
|
||||||
sa.Column('editor', sa.String(length=255), nullable=True),
|
sa.Column('booktitle', sa.String(length=255), nullable=True),
|
||||||
sa.Column('institution', sa.String(length=255), nullable=True),
|
sa.Column('chapter', sa.String(length=255), nullable=True),
|
||||||
sa.Column('journal', sa.String(length=255), nullable=True),
|
sa.Column('editor', sa.String(length=255), nullable=True),
|
||||||
sa.Column('pages', sa.String(length=255), nullable=True),
|
sa.Column('institution', sa.String(length=255), nullable=True),
|
||||||
sa.Column('publisher', sa.String(length=255), nullable=True),
|
sa.Column('journal', sa.String(length=255), nullable=True),
|
||||||
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
sa.Column('pages', sa.String(length=255), nullable=True),
|
||||||
sa.Column('school', sa.String(length=255), nullable=True),
|
sa.Column('publisher', sa.String(length=255), nullable=True),
|
||||||
sa.Column('title', sa.String(length=255), nullable=True),
|
sa.Column('publishing_year', sa.Integer(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['corpus_id'], ['corpora.id'], ),
|
sa.Column('school', sa.String(length=255), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('title', sa.String(length=255), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['corpus_id'], ['corpora.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('job_inputs',
|
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
op.create_table(
|
||||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
'job_inputs',
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('job_id', sa.Integer(), nullable=True),
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('job_id', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('job_results',
|
|
||||||
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
op.create_table(
|
||||||
sa.Column('filename', sa.String(length=255), nullable=True),
|
'job_results',
|
||||||
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||||||
sa.Column('job_id', sa.Integer(), nullable=True),
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||||||
sa.Column('description', sa.String(length=255), nullable=True),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
sa.Column('job_id', sa.Integer(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.Column('description', sa.String(length=255), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
users_dir = os.path.join(current_app.config['NOPAQUE_DATA_DIR'], 'users')
|
||||||
|
if os.path.exists(users_dir):
|
||||||
|
shutil.rmtree(users_dir)
|
||||||
|
|
||||||
|
|
||||||
op.drop_table('job_results')
|
op.drop_table('job_results')
|
||||||
op.drop_table('job_inputs')
|
op.drop_table('job_inputs')
|
||||||
op.drop_table('corpus_files')
|
op.drop_table('corpus_files')
|
||||||
@ -162,4 +194,3 @@ def downgrade():
|
|||||||
op.drop_table('users')
|
op.drop_table('users')
|
||||||
op.drop_index(op.f('ix_roles_default'), table_name='roles')
|
op.drop_index(op.f('ix_roles_default'), table_name='roles')
|
||||||
op.drop_table('roles')
|
op.drop_table('roles')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -17,19 +17,16 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('transkribus_htr_pipeline_models')
|
op.drop_table('transkribus_htr_pipeline_models')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
op.create_table(
|
||||||
op.create_table('transkribus_htr_pipeline_models',
|
'transkribus_htr_pipeline_models',
|
||||||
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
sa.Column('user_id', sa.Integer(), autoincrement=False, nullable=True),
|
||||||
sa.Column('shared', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
sa.Column('shared', sa.Boolean(), autoincrement=False, nullable=True),
|
||||||
sa.Column('transkribus_model_id', sa.INTEGER(), autoincrement=False, nullable=True),
|
sa.Column('transkribus_model_id', sa.Integer(), autoincrement=False, nullable=True),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='transkribus_htr_models_user_id_fkey'),
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='transkribus_htr_models_user_id_fkey'),
|
||||||
sa.PrimaryKeyConstraint('id', name='transkribus_htr_models_pkey')
|
sa.PrimaryKeyConstraint('id', name='transkribus_htr_models_pkey')
|
||||||
)
|
)
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
@ -16,16 +16,18 @@ depends_on = None
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_index('ix_users_token', table_name='users')
|
op.drop_index('ix_users_token', table_name='users')
|
||||||
op.drop_column('users', 'token')
|
op.drop_column('users', 'token')
|
||||||
op.drop_column('users', 'token_expiration')
|
op.drop_column('users', 'token_expiration')
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
op.add_column(
|
||||||
op.add_column('users', sa.Column('token_expiration', sa.DateTime(), autoincrement=False, nullable=True))
|
'users',
|
||||||
op.add_column('users', sa.Column('token', sa.VARCHAR(length=32), autoincrement=False, nullable=True))
|
sa.Column('token_expiration', sa.DateTime(), autoincrement=False, nullable=True)
|
||||||
|
)
|
||||||
|
op.add_column(
|
||||||
|
'users',
|
||||||
|
sa.Column('token', sa.String(length=32), autoincrement=False, nullable=True)
|
||||||
|
)
|
||||||
op.create_index('ix_users_token', 'users', ['token'], unique=False)
|
op.create_index('ix_users_token', 'users', ['token'], unique=False)
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
Loading…
Reference in New Issue
Block a user