Beispiel #1
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'menu',
        sa.Column('class_id', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'menu', type_='foreignkey')
    op.create_foreign_key('menu_class_id_fkey', 'menu', 'class', ['class_id'],
                          ['class_id'])
    op.alter_column('menu',
                    'name',
                    existing_type=sa.VARCHAR(length=128),
                    nullable=True)
    op.drop_column('menu', 'category_id')
    op.create_table(
        'class',
        sa.Column('class_id', sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column('name',
                  sa.VARCHAR(length=64),
                  autoincrement=False,
                  nullable=True),
        sa.Column('order', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('class_id', name='class_pkey'))
    op.drop_table('category')
Beispiel #2
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'elbs',
        sa.Column('account_id',
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True))
    op.create_foreign_key(u'elbs_account_id_fkey', 'elbs', 'accounts',
                          ['account_id'], ['id'])
    op.create_index('ix_elbs_account_id', 'elbs', ['account_id'], unique=False)
    op.drop_column('destinations', 'plugin_name')
    op.create_table(
        'accounts',
        sa.Column(
            'id',
            sa.INTEGER(),
            server_default=sa.text(u"nextval('accounts_id_seq'::regclass)"),
            nullable=False),
        sa.Column('account_number',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=True),
        sa.Column('label',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=True),
        sa.Column('notes', sa.TEXT(), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id', name=u'accounts_pkey'),
        sa.UniqueConstraint('account_number',
                            name=u'accounts_account_number_key'),
        postgresql_ignore_search_path=False)
    op.create_table(
        'certificate_account_associations',
        sa.Column('account_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.Column('certificate_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=True),
        sa.ForeignKeyConstraint(
            ['account_id'], [u'accounts.id'],
            name=u'certificate_account_associations_account_id_fkey',
            ondelete=u'CASCADE'),
        sa.ForeignKeyConstraint(
            ['certificate_id'], [u'certificates.id'],
            name=u'certificate_account_associations_certificate_id_fkey',
            ondelete=u'CASCADE'))
class GcloudRouterQos(model_base.BASEV2, models_v2.HasId, models_v2.HasUserId,
                      models_v2.HasCreateTime, models_v2.HasTenant):
    """Represents a  Router Qos .

    This class is desgin for tengzheng project at 2016.3.2.
    """

    __tablename__ = 'gcloud_router_qoss'

    name = sa.Column(sa.String(length=36),
                     server_default=sa.text(u"''"),
                     nullable=True)
    type = sa.Column(sa.String(length=36), nullable=True)
    max_rate = sa.Column(sa.BIGINT(), autoincrement=False, nullable=False)
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('user_category_uc', 'user_category', type_='unique')
    op.drop_constraint('game_guesses', 'guess', type_='unique')
    op.drop_constraint('game_participants_id', 'game_participants', type_='unique')
    op.create_table('tweeter_user',
    sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False),
    sa.Column('username', sa.VARCHAR(length=140), autoincrement=False, nullable=True),
    sa.Column('name', sa.VARCHAR(length=240), autoincrement=False, nullable=True),
    sa.Column('profile_image_url', sa.TEXT(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='tweeter_user_pkey'),
    sa.UniqueConstraint('name', name='tweeter_user_name_key'),
    sa.UniqueConstraint('username', name='tweeter_user_username_key')
    )
Beispiel #5
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'user', sa.Column('id',
                          sa.BIGINT(),
                          autoincrement=True,
                          nullable=False),
        sa.Column('display_name',
                  sa.VARCHAR(length=32),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('id', name='user_pkey'))
    op.drop_table('greetings')
    op.drop_table('users')
Beispiel #6
0
def upgrade():
    op.create_table('timezone',
                    sa.Column('id', sa.BIGINT(), nullable=False),
                    sa.Column('name', sa.TEXT(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    schema='navitia')
    op.create_table('tz_dst',
                    sa.Column('id', sa.BIGINT(), nullable=False),
                    sa.Column('tz_id', sa.BIGINT(), nullable=False),
                    sa.Column('beginning_date', sa.DATE(), nullable=False),
                    sa.Column('end_date', sa.DATE(), nullable=False),
                    sa.Column('utc_offset', sa.INTEGER(), nullable=False),
                    sa.ForeignKeyConstraint(['tz_id'],
                                            [u'navitia.timezone.id'],
                                            name=u'associated_tz_dst_fkey'),
                    sa.PrimaryKeyConstraint('id'),
                    schema='navitia')
    op.add_column(u'meta_vj',
                  sa.Column('timezone', sa.BIGINT(), nullable=True),
                  schema=u'navitia')
    op.drop_column(u'vehicle_journey',
                   'utc_to_local_offset',
                   schema=u'navitia')
def downgrade():
    op.create_table(
        "complaints",
        sa.Column("id", sa.BIGINT(), autoincrement=True, nullable=False),
        sa.Column(
            "time",
            postgresql.TIMESTAMP(timezone=True),
            server_default=sa.text("now()"),
            autoincrement=False,
            nullable=False,
        ),
        sa.Column("author_user_id",
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column("reported_user_id",
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=False),
        sa.Column("reason", sa.VARCHAR(), autoincrement=False, nullable=False),
        sa.Column("description",
                  sa.VARCHAR(),
                  autoincrement=False,
                  nullable=False),
        sa.ForeignKeyConstraint(["author_user_id"], ["users.id"],
                                name="fk_complaints_author_user_id_users"),
        sa.ForeignKeyConstraint(["reported_user_id"], ["users.id"],
                                name="fk_complaints_reported_user_id_users"),
        sa.PrimaryKeyConstraint("id", name="pk_complaints"),
    )
    op.create_index("ix_complaints_reported_user_id",
                    "complaints", ["reported_user_id"],
                    unique=False)
    op.create_index("ix_complaints_author_user_id",
                    "complaints", ["author_user_id"],
                    unique=False)
    op.drop_table("content_reports")
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('gcloud_router_qoss',
    sa.Column('id', sa.String(length=36), server_default=sa.text(u"''"), nullable=False),
    sa.Column('name', sa.String(length=36), server_default=sa.text(u"''"), nullable=True),
    sa.Column('type', sa.String(length=36), nullable=True),
    sa.Column('max_rate', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.Column('create_time', sa.String(length=26), nullable=False),
    sa.Column('user_id', sa.String(length=64), nullable=False),
    sa.Column('tenant_id', sa.String(length=255), nullable=False)
    )

    op.create_table('gcloud_router_qosrules',
    sa.Column('id', sa.String(length=36), nullable=False),
    sa.Column('qos_id', sa.String(length=36), nullable=False),
    sa.Column('max_rate', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('name', sa.String(length=36), nullable=True),
    sa.Column('create_time', sa.String(length=26), nullable=False),
    sa.ForeignKeyConstraint(['qos_id'], [u'gcloud_router_qoss.id'], name=u'gcloud_route_qosrules_ibfk_1', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )

    op.create_table('gcloud_router_qosrule_binds',
    sa.Column('id', sa.String(length=36), nullable=False),
    sa.Column('qos_id', sa.String(length=36), nullable=False),
    sa.Column('rule_id', sa.String(length=36), nullable=False),
    sa.Column('src_ip', sa.String(length=32), nullable=False),
    sa.Column('port_id', sa.String(length=36), nullable=False),
    sa.Column('user_id', sa.String(length=64), nullable=False),
    sa.Column('create_time', sa.String(length=26), nullable=False),
    sa.Column('ip_type', sa.String(length=26), nullable=False),
    sa.ForeignKeyConstraint(['port_id'], [u'ports.id'], name=u'gcloud_router_qosrule_binds_ibfk_3', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['qos_id'], [u'gcloud_router_qoss.id'], name=u'gcloud_router_qosrule_binds_ibfk_1', ondelete=u'CASCADE'),
    sa.ForeignKeyConstraint(['rule_id'], [u'gcloud_router_qosrules.id'], name=u'gcloud_router_qosrule_binds_ibfk_2', ondelete=u'CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
def upgrade():
    op.drop_constraint('journey_pattern_route_id_fkey',
                       'journey_pattern',
                       schema='navitia')
    op.drop_constraint('journey_pattern_physical_mode_id_fkey',
                       'journey_pattern',
                       schema='navitia')
    op.drop_constraint('vehicle_journey_journey_pattern_id_fkey',
                       'vehicle_journey',
                       schema='navitia')
    op.drop_constraint('stop_time_journey_pattern_point_id_fkey',
                       'stop_time',
                       schema='navitia')
    op.drop_table('journey_pattern_point', schema='navitia')
    op.drop_table('journey_pattern', schema='navitia')
    op.add_column('stop_time',
                  sa.Column('order', sa.INTEGER(), nullable=True),
                  schema='navitia')
    op.add_column('stop_time',
                  sa.Column('shape_from_prev',
                            ga.Geography(geometry_type='LINESTRING',
                                         srid=4326,
                                         spatial_index=False),
                            nullable=True),
                  schema='navitia')
    op.add_column('stop_time',
                  sa.Column('stop_point_id', sa.BIGINT(), nullable=True),
                  schema='navitia')
    op.drop_column('stop_time', 'journey_pattern_point_id', schema='navitia')
    op.add_column('vehicle_journey',
                  sa.Column('physical_mode_id', sa.BIGINT(), nullable=True),
                  schema='navitia')
    op.add_column('vehicle_journey',
                  sa.Column('route_id', sa.BIGINT(), nullable=True),
                  schema='navitia')
    op.drop_column('vehicle_journey', 'journey_pattern_id', schema='navitia')
Beispiel #10
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("ck_pages_main_page_owned_by_cluster")
    op.drop_index("ix_pages_owner_cluster_id_type", table_name="pages")
    op.add_column(
        "pages",
        sa.Column("main_page_for_cluster_id",
                  sa.BIGINT(),
                  autoincrement=False,
                  nullable=True))
    op.create_foreign_key("fk_pages_main_page_for_cluster_id_clusters",
                          "pages", "clusters", ["main_page_for_cluster_id"],
                          ["id"])
    op.create_index("ix_pages_main_page_for_cluster_id",
                    "pages", ["main_page_for_cluster_id"],
                    unique=True)
Beispiel #11
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users',
                    'password',
                    existing_type=sa.String(length=255),
                    type_=sa.VARCHAR(),
                    existing_nullable=False)
    op.alter_column('users',
                    'email',
                    existing_type=sa.String(length=255),
                    type_=sa.VARCHAR(),
                    existing_nullable=False)
    op.alter_column('articles',
                    'id',
                    existing_type=sa.BIGINT(),
                    type_=sa.INTEGER())
class UsageRecord(Base):
    __tablename__ = "usage_record"

    __table_args__ = (
        SA.Index("create_date_index", 'create_date'),
    )

    id = SA.Column(SA.BIGINT(), primary_key=True, autoincrement=True)
    cpu_usage = SA.Column(SA.FLOAT)
    server_load = SA.Column(SA.FLOAT)
    memory_usage = SA.Column(SA.FLOAT)
    disk_usage = SA.Column(SA.FLOAT)
    mysql_cpu = SA.Column(SA.FLOAT)
    mongo_cpu = SA.Column(SA.FLOAT)
    other_service_status = SA.Column(SA.String(512))
    robot_id = SA.Column(SA.INTEGER, nullable=False)
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'admin', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('email', sa.String(length=120), nullable=False),
        sa.Column('password_hash', sa.String(length=128), nullable=True),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'))
    op.create_table(
        'employee', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=120), nullable=False),
        sa.Column('email', sa.String(length=120), nullable=False),
        sa.Column('phone', sa.String(length=120), nullable=False),
        sa.Column('location', sa.String(length=120), nullable=False),
        sa.Column('salary', sa.BIGINT(), nullable=False),
        sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email'),
        sa.UniqueConstraint('phone'))