def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'old_data',
        sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
        sa.Column('text', sa.VARCHAR(), nullable=False),
        sa.Column('results', sqlite.JSON(), nullable=True),
        sa.PrimaryKeyConstraint('id'))
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=120), nullable=True),
    sa.Column('email', sa.VARCHAR(length=120), nullable=True),
    sa.Column('friends', sqlite.JSON(), nullable=True),
    sa.Column('visited', sqlite.JSON(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('ix_user_name', 'user', ['name'], unique=False)
    op.create_index('ix_user_email', 'user', ['email'], unique=1)
    op.drop_table('user_destination_identifier')
    op.drop_index(op.f('ix_users_name'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_index(op.f('ix_destinations_name'), table_name='destinations')
    op.drop_table('destinations')
Exemple #3
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('clients',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=30), nullable=False),
    sa.Column('phone', sa.String(length=11), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('goals',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=15), nullable=False),
    sa.Column('icon', sa.String(length=40), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('icon'),
    sa.UniqueConstraint('name')
    )
    op.create_table('teachers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('about', sa.Text(), nullable=True),
    sa.Column('picture', sa.String(length=50), nullable=True),
    sa.Column('rating', sa.Float(), nullable=True),
    sa.Column('price', sa.Integer(), nullable=False),
    sa.Column('schedule', sqlite.JSON(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('picture')
    )
    op.create_table('bookings',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('day', sa.String(), nullable=True),
    sa.Column('time', sa.String(), nullable=True),
    sa.Column('client_id', sa.Integer(), nullable=True),
    sa.Column('teacher_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['client_id'], ['clients.id'], ),
    sa.ForeignKeyConstraint(['teacher_id'], ['teachers.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('goals_teachers',
    sa.Column('goal_id', sa.Integer(), nullable=True),
    sa.Column('teacher_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['goal_id'], ['goals.id'], ),
    sa.ForeignKeyConstraint(['teacher_id'], ['teachers.id'], )
    )
    op.create_table('requests',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('time', sa.String(), nullable=True),
    sa.Column('client_id', sa.Integer(), nullable=True),
    sa.Column('goal_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['client_id'], ['clients.id'], ),
    sa.ForeignKeyConstraint(['goal_id'], ['goals.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'sidewalk_segment', sa.Column('linearId', sa.INTEGER(),
                                      nullable=False),
        sa.Column('directionInd', sa.VARCHAR(length=50), nullable=False),
        sa.Column('streetName', sa.TEXT(), nullable=True),
        sa.Column('startLat', sa.FLOAT(), nullable=False),
        sa.Column('startLong', sa.FLOAT(), nullable=False),
        sa.Column('endLat', sa.FLOAT(), nullable=False),
        sa.Column('endLong', sa.FLOAT(), nullable=False),
        sa.Column('geoJson', sqlite.JSON(), nullable=False),
        sa.Column('segmentId', sa.INTEGER(), nullable=True),
        sa.PrimaryKeyConstraint('linearId', 'directionInd'))
    op.drop_table('sidewalk_segment2')
Exemple #5
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_event', sa.Column('id', sa.INTEGER(),
                                            nullable=False),
                    sa.Column('user_id', sa.INTEGER(), nullable=True),
                    sa.Column('event_id', sa.INTEGER(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['event_id'],
                        ['events.id'],
                    ), sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_user_event_id', 'user_event', ['id'], unique=False)
    op.create_table(
        'events', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('title', sa.VARCHAR(), nullable=False),
        sa.Column('start', sa.DATETIME(), nullable=False),
        sa.Column('end', sa.DATETIME(), nullable=False),
        sa.Column('content', sa.VARCHAR(), nullable=True),
        sa.Column('location', sa.VARCHAR(), nullable=True),
        sa.Column('color', sa.VARCHAR(), nullable=True),
        sa.Column('owner_id', sa.INTEGER(), nullable=True),
        sa.Column('category_id', sa.INTEGER(), nullable=True),
        sa.ForeignKeyConstraint(
            ['category_id'],
            ['categories.id'],
        ), sa.ForeignKeyConstraint(
            ['owner_id'],
            ['users.id'],
        ), sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_events_id', 'events', ['id'], unique=False)
    op.create_table(
        'zodiac-signs', sa.Column('id', sa.INTEGER(), nullable=False),
        sa.Column('name', sa.VARCHAR(), nullable=False),
        sa.Column('start_month', sa.INTEGER(), nullable=False),
        sa.Column('start_day_in_month', sa.INTEGER(), nullable=False),
        sa.Column('end_month', sa.INTEGER(), nullable=False),
        sa.Column('end_day_in_month', sa.INTEGER(), nullable=False),
        sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_zodiac-signs_id', 'zodiac-signs', ['id'], unique=False)
    op.create_table('wikipedia_events',
                    sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('date_', sa.VARCHAR(), nullable=False),
                    sa.Column('wikipedia', sa.VARCHAR(), nullable=False),
                    sa.Column('events', sqlite.JSON(), nullable=True),
                    sa.Column('date_inserted', sa.DATETIME(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_wikipedia_events_id',
                    'wikipedia_events', ['id'],
                    unique=False)
    op.create_table('quotes', sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('text', sa.VARCHAR(), nullable=False),
                    sa.Column('author', sa.VARCHAR(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_quotes_id', 'quotes', ['id'], unique=False)
    op.create_table('users', sa.Column('id', sa.INTEGER(), nullable=False),
                    sa.Column('username', sa.VARCHAR(), nullable=False),
                    sa.Column('email', sa.VARCHAR(), nullable=False),
                    sa.Column('password', sa.VARCHAR(), nullable=False),
                    sa.Column('full_name', sa.VARCHAR(), nullable=True),
                    sa.Column('language', sa.VARCHAR(), nullable=True),
                    sa.Column('description', sa.VARCHAR(), nullable=True),
                    sa.Column('avatar', sa.VARCHAR(), nullable=True),
                    sa.Column('telegram_id', sa.VARCHAR(), nullable=True),
                    sa.Column('is_active', sa.BOOLEAN(), nullable=True),
                    sa.CheckConstraint('is_active IN (0, 1)'),
                    sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('email'),
                    sa.UniqueConstraint('telegram_id'),
                    sa.UniqueConstraint('username'))
    op.create_index('ix_users_id', 'users', ['id'], unique=False)
    op.create_table('invitations', sa.Column('id',
                                             sa.INTEGER(),
                                             nullable=False),
                    sa.Column('status', sa.VARCHAR(), nullable=False),
                    sa.Column('recipient_id', sa.INTEGER(), nullable=True),
                    sa.Column('event_id', sa.INTEGER(), nullable=True),
                    sa.Column('creation', sa.DATETIME(), nullable=True),
                    sa.ForeignKeyConstraint(
                        ['event_id'],
                        ['events.id'],
                    ), sa.ForeignKeyConstraint(
                        ['recipient_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('id'))
    op.create_index('ix_invitations_id', 'invitations', ['id'], unique=False)
    op.create_table('categories', sa.Column('id', sa.INTEGER(),
                                            nullable=False),
                    sa.Column('name', sa.VARCHAR(), nullable=False),
                    sa.Column('color', sa.VARCHAR(), nullable=False),
                    sa.Column('user_id', sa.INTEGER(), nullable=False),
                    sa.ForeignKeyConstraint(
                        ['user_id'],
                        ['users.id'],
                    ), sa.PrimaryKeyConstraint('id'),
                    sa.UniqueConstraint('user_id', 'name', 'color'))
    op.create_index('ix_categories_id', 'categories', ['id'], unique=False)
Exemple #6
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('index_queue', sa.Column('detail', sqlite.JSON(), nullable=False))
Exemple #7
0
def downgrade():
    with op.batch_alter_table('rule_entries') as batch_op:
        batch_op.add_column(
            sa.Column('operations_v2', sqlite.JSON(), nullable=True))
        batch_op.drop_column('operations')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('db_activity', schema=None) as batch_op:
        batch_op.add_column(sa.Column('df', sqlite.JSON(), nullable=True))