mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 09:15:41 +00:00
54 lines
1.9 KiB
Python
54 lines
1.9 KiB
Python
|
"""Add spacy_nlp_pipeline_models table
|
||
|
|
||
|
Revision ID: 31dd42e5ea6f
|
||
|
Revises: a3b727e3ff71
|
||
|
Create Date: 2022-10-13 12:47:50.870474
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import shutil
|
||
|
import sqlalchemy as sa
|
||
|
import os
|
||
|
from app.models import User
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '31dd42e5ea6f'
|
||
|
down_revision = 'a3b727e3ff71'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
for user in User.query.all():
|
||
|
os.mkdir(os.path.join(user.path, 'spacy_nlp_pipeline_models'))
|
||
|
op.create_table('spacy_nlp_pipeline_models',
|
||
|
sa.Column('creation_date', sa.DateTime(), nullable=True),
|
||
|
sa.Column('filename', sa.String(length=255), nullable=True),
|
||
|
sa.Column('last_edited_date', sa.DateTime(), nullable=True),
|
||
|
sa.Column('mimetype', sa.String(length=255), nullable=True),
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||
|
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():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
for user in User.query.all():
|
||
|
shutil.rmtree(os.path.join(user.path, 'spacy_nlp_pipeline_models'))
|
||
|
op.drop_table('spacy_nlp_pipeline_models')
|
||
|
# ### end Alembic commands ###
|