Skip to content

Commit

Permalink
Merge pull request #88 from FIUS/feature/api-upgrade
Browse files Browse the repository at this point in the history
Feature/api upgrade
  • Loading branch information
mee4895 authored Jun 14, 2019
2 parents 38fc30e + 90c05ab commit 4ebcbb5
Show file tree
Hide file tree
Showing 83 changed files with 2,186 additions and 1,308 deletions.
1 change: 1 addition & 0 deletions migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def process_revision_directives(context, revision, directives):
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
render_as_batch=True,
compare_type=True,
**current_app.extensions['migrate'].configure_args)

try:
Expand Down
44 changes: 0 additions & 44 deletions migrations/versions/2181bdb161da_.py

This file was deleted.

32 changes: 0 additions & 32 deletions migrations/versions/70ab97044985_.py

This file was deleted.

34 changes: 0 additions & 34 deletions migrations/versions/73e290cb35a9_.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""empty message
Revision ID: 29d8df81268e
Revises:
Create Date: 2018-07-16 16:11:00.902328
Revision ID: cd02e7f9639a
Revises:
Create Date: 2019-06-14 17:51:42.375806
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '29d8df81268e'
revision = 'cd02e7f9639a'
down_revision = None
branch_labels = None
depends_on = None
Expand All @@ -24,7 +24,7 @@ def upgrade():
sa.Column('type', sa.String(length=190), nullable=True),
sa.Column('jsonschema', sa.Text(), nullable=True),
sa.Column('visible_for', sa.String(length=190), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('deleted_time', sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_AttributeDefinition')),
sa.UniqueConstraint('name', name=op.f('uq_AttributeDefinition_name'))
)
Expand All @@ -44,7 +44,7 @@ def upgrade():
sa.Column('name_schema', sa.String(length=190), nullable=True),
sa.Column('lendable', sa.Boolean(), nullable=True),
sa.Column('lending_duration', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('deleted_time', sa.Integer(), nullable=True),
sa.Column('visible_for', sa.String(length=190), nullable=True),
sa.Column('how_to', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_ItemType')),
Expand All @@ -54,23 +54,31 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('moderator', sa.String(length=190), nullable=True),
sa.Column('user', sa.String(length=190), nullable=True),
sa.Column('date', sa.DateTime(), nullable=True),
sa.Column('date', sa.Integer(), nullable=True),
sa.Column('deposit', sa.String(length=190), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_Lending'))
)
op.create_table('Settings',
sa.Column('user', sa.String(length=190), nullable=False),
sa.Column('settings', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('user', name=op.f('pk_Settings'))
)
with op.batch_alter_table('Settings', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_Settings_user'), ['user'], unique=False)

op.create_table('Tag',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=190), nullable=True),
sa.Column('lending_duration', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('deleted_time', sa.Integer(), nullable=True),
sa.Column('visible_for', sa.String(length=190), nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('pk_Tag')),
sa.UniqueConstraint('name', name=op.f('uq_Tag_name'))
)
op.create_table('BlacklistToItemType',
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('item_type_id', sa.Integer(), nullable=False),
sa.Column('end_time', sa.DateTime(), nullable=True),
sa.Column('end_time', sa.Integer(), nullable=True),
sa.Column('reason', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['item_type_id'], ['ItemType.id'], name=op.f('fk_BlacklistToItemType_item_type_id')),
sa.ForeignKeyConstraint(['user_id'], ['Blacklist.id'], name=op.f('fk_BlacklistToItemType_user_id')),
Expand All @@ -79,13 +87,17 @@ def upgrade():
op.create_table('Item',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=190), nullable=True),
sa.Column('update_name_from_schema', sa.Boolean(), nullable=False),
sa.Column('type_id', sa.Integer(), nullable=True),
sa.Column('lending_id', sa.Integer(), nullable=True),
sa.Column('lending_duration', sa.Integer(), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('due', sa.Integer(), nullable=True),
sa.Column('deleted_time', sa.Integer(), nullable=True),
sa.Column('visible_for', sa.String(length=190), nullable=True),
sa.ForeignKeyConstraint(['lending_id'], ['Lending.id'], name=op.f('fk_Item_lending_id')),
sa.ForeignKeyConstraint(['type_id'], ['ItemType.id'], name=op.f('fk_Item_type_id')),
sa.PrimaryKeyConstraint('id', name=op.f('pk_Item')),
sa.UniqueConstraint('name', name=op.f('uq_Item_name'))
sa.UniqueConstraint('name', 'type_id', name='_name_type_id_uc')
)
op.create_table('ItemTypeToAttributeDefinition',
sa.Column('item_type_id', sa.Integer(), nullable=False),
Expand Down Expand Up @@ -114,19 +126,17 @@ def upgrade():
sa.Column('name', sa.String(length=190), nullable=True),
sa.Column('file_type', sa.String(length=190), nullable=True),
sa.Column('file_hash', sa.String(length=190), nullable=True),
sa.Column('creation', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=True),
sa.Column('invalidation', sa.DateTime(), nullable=True),
sa.Column('creation', sa.Integer(), nullable=True),
sa.Column('invalidation', sa.Integer(), nullable=True),
sa.Column('visible_for', sa.String(length=190), nullable=True),
sa.ForeignKeyConstraint(['item_id'], ['Item.id'], name=op.f('fk_File_item_id')),
sa.PrimaryKeyConstraint('id', name=op.f('pk_File'))
)
with op.batch_alter_table('File', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_File_file_hash'), ['file_hash'], unique=False)

op.create_table('ItemToAttributeDefinition',
sa.Column('item_id', sa.Integer(), nullable=False),
sa.Column('attribute_definition_id', sa.Integer(), nullable=False),
sa.Column('value', sa.String(length=190), nullable=True),
sa.Column('deleted', sa.Boolean(), nullable=True),
sa.Column('deleted_time', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['attribute_definition_id'], ['AttributeDefinition.id'], name=op.f('fk_ItemToAttributeDefinition_attribute_definition_id')),
sa.ForeignKeyConstraint(['item_id'], ['Item.id'], name=op.f('fk_ItemToAttributeDefinition_item_id')),
sa.PrimaryKeyConstraint('item_id', 'attribute_definition_id', name=op.f('pk_ItemToAttributeDefinition'))
Expand All @@ -138,14 +148,6 @@ def upgrade():
sa.ForeignKeyConstraint(['parent_id'], ['Item.id'], name=op.f('fk_ItemToItem_parent_id')),
sa.PrimaryKeyConstraint('parent_id', 'item_id', name=op.f('pk_ItemToItem'))
)
op.create_table('ItemToLending',
sa.Column('item_id', sa.Integer(), nullable=False),
sa.Column('lending_id', sa.Integer(), nullable=False),
sa.Column('due', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['item_id'], ['Item.id'], name=op.f('fk_ItemToLending_item_id')),
sa.ForeignKeyConstraint(['lending_id'], ['Lending.id'], name=op.f('fk_ItemToLending_lending_id')),
sa.PrimaryKeyConstraint('item_id', 'lending_id', name=op.f('pk_ItemToLending'))
)
op.create_table('ItemToTag',
sa.Column('item_id', sa.Integer(), nullable=False),
sa.Column('tag_id', sa.Integer(), nullable=False),
Expand All @@ -159,19 +161,19 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('ItemToTag')
op.drop_table('ItemToLending')
op.drop_table('ItemToItem')
op.drop_table('ItemToAttributeDefinition')
with op.batch_alter_table('File', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_File_file_hash'))

op.drop_table('File')
op.drop_table('TagToAttributeDefinition')
op.drop_table('ItemTypeToItemType')
op.drop_table('ItemTypeToAttributeDefinition')
op.drop_table('Item')
op.drop_table('BlacklistToItemType')
op.drop_table('Tag')
with op.batch_alter_table('Settings', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_Settings_user'))

op.drop_table('Settings')
op.drop_table('Lending')
op.drop_table('ItemType')
with op.batch_alter_table('Blacklist', schema=None) as batch_op:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask==1.0.2
flask-restplus==0.11.0
flask-restplus==0.12.1
Flask-SQLAlchemy==2.3.1
Flask-Migrate==2.2.1
Flask-Webpack==0.1.0
Expand Down
1 change: 1 addition & 0 deletions total_tolles_ferleihsystem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
APP.logger.info('Connecting to database %s.', APP.config['SQLALCHEMY_DATABASE_URI'])

AUTH_LOGGER = getLogger('flask.app.auth') # type: Logger
LENDING_LOGGER = getLogger('ttf.lending') # type: Logger

# Setup DB with Migrations and bcrypt
DB: SQLAlchemy
Expand Down
Loading

0 comments on commit 4ebcbb5

Please sign in to comment.