Exemplo n.º 1
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cart',
    sa.Column('cid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('cnumber', sa.Integer(), nullable=True),
    sa.Column('cprice', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('pid', sa.Integer(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['pid'], ['product.pid'], ),
    sa.ForeignKeyConstraint(['uid'], ['user.uid'], ),
    sa.PrimaryKeyConstraint('cid')
    )
    op.create_index(op.f('ix_cart_cid'), 'cart', ['cid'], unique=False)
    op.create_table('detailed_order',
    sa.Column('detailedoid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('number', sa.Integer(), nullable=True),
    sa.Column('dprice', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('status', sa.String(length=50), nullable=True),
    sa.Column('orderid', sa.Integer(), nullable=True),
    sa.Column('pid', sa.Integer(), nullable=True),
    sa.Column('oid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['oid'], ['official_user.oid'], ),
    sa.ForeignKeyConstraint(['orderid'], ['order.orderid'], ),
    sa.ForeignKeyConstraint(['pid'], ['product.pid'], ),
    sa.PrimaryKeyConstraint('detailedoid')
    )
    op.create_index(op.f('ix_detailed_order_detailedoid'), 'detailed_order', ['detailedoid'], unique=False)
Exemplo n.º 2
0
class User(BASE):
    __tablename__ = "users_main"
    id = Column("ID", mysql.INTEGER(10, unsigned=True), primary_key=True)
    username = Column('Username', mysql.VARCHAR(20))
    email = Column('Email', mysql.VARCHAR(255))
    pass_hash = Column('PassHash', mysql.VARCHAR(60))
    secret = Column('Secret', mysql.VARCHAR(32))
    irc_key = Column('IRCKey', mysql.CHAR(32))
    last_login = Column('LastLogin', mysql.DATETIME)
    last_access = Column('LastAccess', mysql.DATETIME)
    ip = Column('IP', mysql.VARCHAR(15))
    class_id = Column('Class', mysql.TINYINT(2))
    uploaded = Column('Uploaded', mysql.BIGINT(20, unsigned=True))
    downloaded = Column('Downloaded', mysql.BIGINT(20, unsigned=True))
    title = Column('Title', mysql.TEXT)
    enabled = Column('Enabled', mysql.ENUM('0', '1', '2'))
    paranoia = Column('Paranoia', mysql.TEXT)
    visible = Column('Visible', mysql.ENUM('1', '0'))
    invites = Column('Invites', mysql.INTEGER(10, unsigned=True))
    permission_id = Column('PermissionID', mysql.INTEGER(10, unsigned=True),
                           ForeignKey('permissions.ID'))
    custom_permissions = Column('CustomPermissions', mysql.TEXT)
    can_leech = Column('can_leech', mysql.TINYINT(4))
    torrent_pass = Column('torrent_pass', mysql.CHAR(32))
    required_ratio = Column('RequiredRatio', mysql.DOUBLE(10, 8))
    required_ratio_work = Column('RequiredRatioWork', mysql.DOUBLE(10, 8))
    ipcc = Column('ipcc', mysql.VARCHAR(2))
    fl_tokens = Column('FLTokens', mysql.INTEGER(10))

    permission_class = relationship("Permissions")

    info = relationship("UsersInfo")

    def get_paranoia(self):
        return dict_to_list(unserialize(bytes(str(self.paranoia), 'utf-8')))
Exemplo n.º 3
0
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('core_sensor',
                    'last_value',
                    existing_type=mysql.VARCHAR(length=32),
                    type_=sa.Unicode(length=255),
                    existing_nullable=True)
    op.alter_column('core_sensor',
                    'value_max',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    type_=sa.Float(precision=53),
                    existing_nullable=True)
    op.alter_column('core_sensor',
                    'value_min',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    type_=sa.Float(precision=53),
                    existing_nullable=True)
    op.alter_column('core_sensor_history',
                    'original_value_num',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    type_=sa.Float(precision=53),
                    existing_nullable=True)
    op.alter_column('core_sensor_history',
                    'value_num',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    type_=sa.Float(precision=53),
                    existing_nullable=True)
    op.alter_column('core_sensor_history',
                    'value_str',
                    existing_type=mysql.VARCHAR(length=32),
                    type_=sa.Unicode(length=255),
                    existing_nullable=False)
Exemplo n.º 4
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'order',
        sa.Column('orderid', sa.Integer(), autoincrement=True, nullable=False),
        sa.Column('oprice', mysql.DOUBLE(asdecimal=True), nullable=True),
        sa.Column('odate', sa.DateTime(), nullable=True),
        sa.Column('address', sa.String(length=500), nullable=True),
        sa.Column('status', sa.String(length=50), nullable=True),
        sa.Column('uid', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['uid'],
            ['user.uid'],
        ), sa.PrimaryKeyConstraint('orderid'))
    op.create_index(op.f('ix_order_orderid'),
                    'order', ['orderid'],
                    unique=False)
    op.create_table(
        'product',
        sa.Column('pid', sa.Integer(), autoincrement=True, nullable=False),
        sa.Column('pname', sa.String(length=500), nullable=True),
        sa.Column('pprice', mysql.DOUBLE(asdecimal=True), nullable=True),
        sa.Column('pdate', sa.DateTime(), nullable=True),
        sa.Column('remain', sa.Integer(), nullable=True),
        sa.Column('description', sa.String(length=500), nullable=True),
        sa.Column('oid', sa.Integer(), nullable=True),
        sa.Column('typeid', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['oid'],
            ['official_user.oid'],
        ), sa.ForeignKeyConstraint(
            ['typeid'],
            ['type.typeid'],
        ), sa.PrimaryKeyConstraint('pid'), sa.UniqueConstraint('pname'))
    op.create_index(op.f('ix_product_pid'), 'product', ['pid'], unique=False)
Exemplo n.º 5
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        'collection',
        sa.Column('longitude_f', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'collection',
        sa.Column('latitude_f', mysql.DOUBLE(asdecimal=True), nullable=True))
Exemplo n.º 6
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('invtypes', sa.Column('portionSize', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('basePrice', mysql.DECIMAL(precision=19, scale=4), nullable=True))
    op.add_column('invtypes', sa.Column('mass', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column('invtypes', sa.Column('soundID', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('volume', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column('invtypes', sa.Column('published', mysql.TINYINT(display_width=4), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('iconID', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('raceID', mysql.SMALLINT(display_width=6), autoincrement=False, nullable=True))
    op.add_column('invtypes', sa.Column('capacity', mysql.DOUBLE(asdecimal=True), nullable=True))
Exemplo n.º 7
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'operations', sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('currency', sa.String(length=3), nullable=False),
        sa.Column('amount',
                  mysql.DOUBLE(precision=15, scale=8, asdecimal=True),
                  nullable=False),
        sa.Column('price',
                  mysql.DOUBLE(precision=15, scale=8, asdecimal=True),
                  nullable=True),
        sa.Column('final_amount',
                  mysql.DOUBLE(precision=15, scale=8, asdecimal=True),
                  nullable=True),
        sa.Column('requested_time', sa.DateTime(), nullable=False),
        sa.PrimaryKeyConstraint('id'))
Exemplo n.º 8
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('apscheduler_jobs',
                    sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
                    sa.Column('next_run_time',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('job_state', sa.BLOB(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_0900_ai_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('ix_apscheduler_jobs_next_run_time',
                    'apscheduler_jobs', ['next_run_time'],
                    unique=False)
    op.create_table('sessions',
                    sa.Column('id',
                              mysql.INTEGER(),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('session_id',
                              mysql.VARCHAR(length=255),
                              nullable=True),
                    sa.Column('data', sa.BLOB(), nullable=True),
                    sa.Column('expiry', mysql.DATETIME(), nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate='utf8mb4_0900_ai_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('session_id', 'sessions', ['session_id'], unique=True)
Exemplo n.º 9
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('menu_item',
                    sa.Column('menu_item_number',
                              mysql.INTEGER(display_width=10),
                              autoincrement=False,
                              nullable=False),
                    sa.Column('item_name',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=128),
                              nullable=False),
                    sa.Column('price',
                              mysql.DOUBLE(precision=3,
                                           scale=2,
                                           asdecimal=True),
                              nullable=False),
                    sa.Column('drinkstatus',
                              mysql.TINYINT(display_width=1),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('drink_type',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              nullable=True),
                    sa.Column('drink_description',
                              mysql.VARCHAR(collation='utf8mb4_unicode_ci',
                                            length=255),
                              nullable=True),
                    sa.PrimaryKeyConstraint('menu_item_number'),
                    mysql_collate='utf8mb4_unicode_ci',
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
Exemplo n.º 10
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('order_item', 'employee_id',
               existing_type=mysql.INTEGER(display_width=10),
               nullable=True)
    op.alter_column('order_item', 'add_on_number',
               existing_type=mysql.INTEGER(display_width=10),
               nullable=True)
    op.add_column('drink_order', sa.Column('add_on_number', mysql.INTEGER(display_width=10), autoincrement=False, nullable=True))
    op.add_column('drink_order', sa.Column('menu_item_number', mysql.INTEGER(display_width=10), autoincrement=False, nullable=False))
    op.add_column('drink_order', sa.Column('total_price', mysql.DOUBLE(precision=4, scale=2, asdecimal=True), nullable=True))
    op.add_column('drink_order', sa.Column('employee_id', mysql.INTEGER(display_width=10), autoincrement=False, nullable=True))
    op.create_foreign_key('drink_order_ibfk_4', 'drink_order', 'add_on_item', ['add_on_number'], ['add_on_number'])
    op.create_foreign_key('drink_order_ibfk_1', 'drink_order', 'menu_item', ['menu_item_number'], ['menu_item_number'])
    op.create_foreign_key('drink_order_ibfk_3', 'drink_order', 'employee', ['employee_id'], ['employee_id'])
    op.alter_column('drink_order', 'order_date',
               existing_type=mysql.DATETIME(),
               nullable=False)
    op.create_table('customer',
    sa.Column('email', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=64), nullable=False),
    sa.Column('customer_name', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=255), nullable=False),
    sa.Column('phone', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=255), nullable=True),
    sa.Column('address', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=255), nullable=True),
    sa.PrimaryKeyConstraint('email'),
    mysql_collate='utf8mb4_unicode_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
Exemplo n.º 11
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('username',
                              mysql.VARCHAR(length=80),
                              nullable=True),
                    sa.Column('email',
                              mysql.VARCHAR(length=120),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='latin1',
                    mysql_engine='InnoDB')
    op.create_table('location',
                    sa.Column('pri_id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('description',
                              mysql.VARCHAR(length=80),
                              nullable=True),
                    sa.Column('data_time', mysql.DATETIME(), nullable=True),
                    sa.Column('longtitude',
                              mysql.DOUBLE(precision=9,
                                           scale=7,
                                           asdecimal=True),
                              nullable=True),
                    sa.Column('latitude',
                              mysql.DOUBLE(precision=9,
                                           scale=7,
                                           asdecimal=True),
                              nullable=True),
                    sa.Column('elevation',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('pri_id'),
                    mysql_default_charset='latin1',
                    mysql_engine='InnoDB')
    op.drop_table('assetlocation')
Exemplo n.º 12
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('users', 'is_student')
    op.drop_column('users', 'is_staff')
    op.alter_column('settings',
                    'notification_period',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    nullable=True)
Exemplo n.º 13
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('add_on_item',
                    'price',
                    existing_type=mysql.DOUBLE(precision=3,
                                               scale=2,
                                               asdecimal=True),
                    nullable=False)
Exemplo n.º 14
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('delivery_order',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('order_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_contact', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('pickup_contact_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_contact', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('dropoff_contact_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('item_value_cost', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('notes', mysql.TEXT(), nullable=False),
    sa.Column('delivery_fee', mysql.DOUBLE(asdecimal=True), nullable=False),
    sa.Column('invoice_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('mpesa_payment_id', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('date_created', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('order_status', mysql.VARCHAR(length=255), server_default=sa.text("'New'"), nullable=True),
    sa.Column('rider_id', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('rider_pickup_date', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('rider_delivery_date', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('rider_notes', mysql.TEXT(), nullable=True),
    sa.Column('user_feedback', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('user',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('firstname', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('lastname', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('email', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('phone_number', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('push_notificaiton_id', mysql.TEXT(), nullable=True),
    sa.Column('date_created', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('phone_number_verified', mysql.INTEGER(display_width=11), server_default=sa.text('0'), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('login',
    sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False),
    sa.Column('user_id', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('email_address', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('password', mysql.VARCHAR(length=255), nullable=False),
    sa.Column('role', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
    sa.Column('status', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
    sa.Column('date_created', mysql.BIGINT(display_width=20), autoincrement=False, nullable=False),
    sa.Column('last_login', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.drop_table('users')
    op.drop_table('blacklist_tokens')
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('games',
                    'duration',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    nullable=False)
    op.drop_constraint(None, 'game_balances', type_='foreignkey')
    op.drop_column('game_balances', 'dividend_id')
    op.drop_table('dividends')
Exemplo n.º 16
0
class Notification(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(128), index=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    timestamp = db.Column(mysql.DOUBLE(), index=True, default=time)
    payload_json = db.Column(db.Text)

    def get_data(self):
        return json.loads(str(self.payload_json))
Exemplo n.º 17
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('settings',
                    'notification_period',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    nullable=False)
    op.add_column('users', sa.Column('is_staff', sa.Boolean(), nullable=True))
    op.add_column('users', sa.Column('is_student', sa.Boolean(),
                                     nullable=True))
Exemplo n.º 18
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('gaodemapscene_test',
                    sa.Column('id', mysql.CHAR(length=20), nullable=False),
                    sa.Column('province', mysql.CHAR(length=50),
                              nullable=True),
                    sa.Column('city', mysql.CHAR(length=50), nullable=True),
                    sa.Column('name', mysql.CHAR(length=50), nullable=True),
                    sa.Column('city_adcode',
                              mysql.CHAR(length=20),
                              nullable=False),
                    sa.Column('district', mysql.CHAR(length=50),
                              nullable=True),
                    sa.Column('address', mysql.CHAR(length=100),
                              nullable=True),
                    sa.Column('longtitude',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('lat',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('type', mysql.CHAR(length=100), nullable=True),
                    sa.Column('typecode', mysql.CHAR(length=20),
                              nullable=True),
                    sa.Column('classify',
                              mysql.CHAR(length=100),
                              nullable=True),
                    sa.Column('area',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('shape', mysql.TEXT(), nullable=True),
                    sa.Column('wgs_long',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('wgs_lat',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('wgs_shape', mysql.TEXT(), nullable=True),
                    sa.PrimaryKeyConstraint('id', 'city_adcode'),
                    mysql_default_charset='utf8',
                    mysql_engine='InnoDB')
    op.drop_table('database')
Exemplo n.º 19
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('apscheduler_jobs',
    sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
    sa.Column('next_run_time', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('job_state', sa.BLOB(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_apscheduler_jobs_next_run_time', 'apscheduler_jobs', ['next_run_time'], unique=False)
Exemplo n.º 20
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('image_meta',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('path',
                              mysql.VARCHAR(length=1024),
                              nullable=False),
                    sa.Column('format',
                              mysql.VARCHAR(length=20),
                              nullable=True),
                    sa.Column('size',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('width',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('height',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('channel',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate=u'utf8mb4_0900_ai_ci',
                    mysql_default_charset=u'utf8mb4',
                    mysql_engine=u'InnoDB')
    op.create_table('test_table_1',
                    sa.Column('id',
                              mysql.INTEGER(display_width=11),
                              autoincrement=True,
                              nullable=False),
                    sa.Column('name',
                              mysql.VARCHAR(length=256),
                              nullable=False),
                    sa.Column('count',
                              mysql.INTEGER(display_width=11),
                              autoincrement=False,
                              nullable=True),
                    sa.Column('score',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_collate=u'utf8mb4_0900_ai_ci',
                    mysql_default_charset=u'utf8mb4',
                    mysql_engine=u'InnoDB')
    op.drop_table('ImageMeta')
Exemplo n.º 21
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('room_message',
                    'modified_date',
                    existing_type=sa.DateTime(timezone=True),
                    type_=mysql.DOUBLE(asdecimal=True),
                    existing_nullable=True)
    op.alter_column('room_message',
                    'created_date',
                    existing_type=sa.DateTime(timezone=True),
                    type_=mysql.DOUBLE(asdecimal=True),
                    existing_nullable=True)
    op.alter_column('personal_message',
                    'modified_date',
                    existing_type=sa.DateTime(timezone=True),
                    type_=mysql.DOUBLE(asdecimal=True),
                    existing_nullable=True)
    op.alter_column('personal_message',
                    'created_date',
                    existing_type=sa.DateTime(timezone=True),
                    type_=mysql.DOUBLE(asdecimal=True),
                    existing_nullable=True)
Exemplo n.º 22
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('gps_ic_merge_bas_ic',
    sa.Column('CARDID', mysql.TEXT(), nullable=True),
    sa.Column('CARDTYPE_NAME', mysql.TEXT(), nullable=True),
    sa.Column('TXNDATE', mysql.DATETIME(), nullable=True),
    sa.Column('TXNAMT', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('BUSID', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('bus_id', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('line_id', mysql.TEXT(), nullable=True),
    sa.Column('seconds', mysql.BIGINT(display_width=20), autoincrement=False, nullable=True),
    sa.Column('second_diff', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('IS_STATION', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('STATION_NAME', mysql.TEXT(), nullable=True),
    sa.Column('banci_csig', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    mysql_default_charset='utf8',
    mysql_engine='InnoDB'
    )
    op.create_table('station_roadlu',
    sa.Column('FID', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('linename', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('sxxid', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('stopid', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('stopname', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('lng', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('lat', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('FID_', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('RoadName', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('GHDLDJ', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('GH_width', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('XZ_width', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('JDCDS', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('Finished', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('Shape_Leng', mysql.VARCHAR(length=255), nullable=True),
    mysql_default_charset='gbk',
    mysql_engine='InnoDB',
    mysql_row_format='COMPACT'
    )
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('dividends', sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('symbol', sa.Text(), nullable=True),
                    sa.Column('company', sa.Text(), nullable=True),
                    sa.Column('amount', sa.Float(precision=32), nullable=True),
                    sa.Column('exec_date', sa.Integer(), nullable=True),
                    sa.PrimaryKeyConstraint('id'))
    op.add_column('game_balances',
                  sa.Column('dividend_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'game_balances', 'dividends', ['dividend_id'],
                          ['id'])
    op.alter_column('games',
                    'duration',
                    existing_type=mysql.DOUBLE(asdecimal=True),
                    nullable=True)
Exemplo n.º 24
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('dmp_chart', 'chart_name',
               existing_type=mysql.VARCHAR(length=64),
               comment='图标名称',
               existing_comment='图表名称',
               existing_nullable=False)
    op.drop_column('dmp_chart', 'charts_position')
    op.create_table('apscheduler_jobs',
    sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
    sa.Column('next_run_time', mysql.DOUBLE(asdecimal=True), nullable=True),
    sa.Column('job_state', sa.BLOB(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.create_index('ix_apscheduler_jobs_next_run_time', 'apscheduler_jobs', ['next_run_time'], unique=False)
Exemplo n.º 25
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('dmp_chart',
                    'update_unit',
                    existing_type=mysql.INTEGER(display_width=11),
                    nullable=False,
                    existing_comment='时间间隔单位,0小时,1日,3周')
    op.alter_column('dmp_chart',
                    'update_interval',
                    existing_type=mysql.INTEGER(display_width=11),
                    nullable=False,
                    existing_comment='时间间隔时间')
    op.alter_column('dmp_chart',
                    'query_string',
                    existing_type=mysql.TEXT(),
                    nullable=False,
                    existing_comment='查询语句')
    op.alter_column('dmp_chart',
                    'params',
                    existing_type=mysql.TEXT(),
                    nullable=False,
                    existing_comment='图表参数')
    op.alter_column('dmp_chart',
                    'dmp_data_table_id',
                    existing_type=mysql.INTEGER(display_width=11),
                    nullable=False,
                    existing_comment='数据表ID')
    op.alter_column('dmp_chart',
                    'chart_data',
                    existing_type=mysql.TEXT(),
                    nullable=False,
                    existing_comment='数据')
    op.create_table('apscheduler_jobs',
                    sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
                    sa.Column('next_run_time',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('job_state', sa.BLOB(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('ix_apscheduler_jobs_next_run_time',
                    'apscheduler_jobs', ['next_run_time'],
                    unique=False)
Exemplo n.º 26
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('dmp_data_service',
                    'source_dmp_data_table_id',
                    existing_type=mysql.INTEGER(display_width=11),
                    nullable=False,
                    existing_comment='数据表ID')
    op.drop_column('dmp_chart', 'update_task_id')
    op.create_table('apscheduler_jobs',
                    sa.Column('id', mysql.VARCHAR(length=191), nullable=False),
                    sa.Column('next_run_time',
                              mysql.DOUBLE(asdecimal=True),
                              nullable=True),
                    sa.Column('job_state', sa.BLOB(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    mysql_default_charset='utf8mb4',
                    mysql_engine='InnoDB')
    op.create_index('ix_apscheduler_jobs_next_run_time',
                    'apscheduler_jobs', ['next_run_time'],
                    unique=False)
def downgrade():
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-1', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-2', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-3', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-4', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-5', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-6', mysql.DOUBLE(asdecimal=True), nullable=True))
    op.add_column(
        'etablissements_backoffice',
        sa.Column('semester-7', mysql.DOUBLE(asdecimal=True), nullable=True))

    op.drop_column('etablissements_backoffice', 'dpae-period-7')
    op.drop_column('etablissements_backoffice', 'dpae-period-6')
    op.drop_column('etablissements_backoffice', 'dpae-period-5')
    op.drop_column('etablissements_backoffice', 'dpae-period-4')
    op.drop_column('etablissements_backoffice', 'dpae-period-3')
    op.drop_column('etablissements_backoffice', 'dpae-period-2')
    op.drop_column('etablissements_backoffice', 'dpae-period-1')

    op.drop_column('etablissements_backoffice', 'score_alternance')
    op.drop_column('etablissements_backoffice', 'score_alternance_regr')

    op.drop_column('etablissements_backoffice', 'alt-period-7')
    op.drop_column('etablissements_backoffice', 'alt-period-6')
    op.drop_column('etablissements_backoffice', 'alt-period-5')
    op.drop_column('etablissements_backoffice', 'alt-period-4')
    op.drop_column('etablissements_backoffice', 'alt-period-3')
    op.drop_column('etablissements_backoffice', 'alt-period-2')
    op.drop_column('etablissements_backoffice', 'alt-period-1')
Exemplo n.º 28
0
ALL_TABLES = [
    TABLE_STATES,
    TABLE_EVENTS,
    TABLE_RECORDER_RUNS,
    TABLE_SCHEMA_CHANGES,
    TABLE_STATISTICS,
    TABLE_STATISTICS_META,
    TABLE_STATISTICS_RUNS,
    TABLE_STATISTICS_SHORT_TERM,
]

DATETIME_TYPE = DateTime(timezone=True).with_variant(
    mysql.DATETIME(timezone=True, fsp=6), "mysql")
DOUBLE_TYPE = (Float().with_variant(
    mysql.DOUBLE(asdecimal=False),
    "mysql").with_variant(oracle.DOUBLE_PRECISION(),
                          "oracle").with_variant(postgresql.DOUBLE_PRECISION(),
                                                 "postgresql"))


class Events(Base):  # type: ignore
    """Event history data."""

    __table_args__ = (
        # Used for fetching events at a specific time
        # see logbook
        Index("ix_events_event_type_time_fired", "event_type", "time_fired"),
        {
            "mysql_default_charset": "utf8mb4",
            "mysql_collate": "utf8mb4_unicode_ci"
    TABLE_STATES,
    TABLE_EVENTS,
    TABLE_RECORDER_RUNS,
    TABLE_SCHEMA_CHANGES,
    TABLE_STATISTICS,
    TABLE_STATISTICS_META,
    TABLE_STATISTICS_RUNS,
    TABLE_STATISTICS_SHORT_TERM,
]

DATETIME_TYPE = DateTime(timezone=True).with_variant(
    mysql.DATETIME(timezone=True, fsp=6), "mysql"
)
DOUBLE_TYPE = (
    Float()
    .with_variant(mysql.DOUBLE(asdecimal=False), "mysql")
    .with_variant(oracle.DOUBLE_PRECISION(), "oracle")
    .with_variant(postgresql.DOUBLE_PRECISION(), "postgresql")
)


class Events(Base):  # type: ignore
    """Event history data."""

    __table_args__ = (
        # Used for fetching events at a specific time
        # see logbook
        Index("ix_events_event_type_time_fired", "event_type", "time_fired"),
        {"mysql_default_charset": "utf8mb4", "mysql_collate": "utf8mb4_unicode_ci"},
    )
    __tablename__ = TABLE_EVENTS
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('rel_user')
    op.drop_table('rel_user_text')
    op.drop_table('rel_user_multi')
    ### end Alembic commands ###
    
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('rel_user_multi',
    sa.Column('rum_id', mysql.INTEGER(display_width=10, unsigned=True), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('rel_lookup', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('attribute', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('rum_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('rel_user_text',
    sa.Column('rut_id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('user_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('rel_lookup', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('attribute', mysql.TEXT(), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('rut_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('rel_user',
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), server_default=sa.text(u"'0'"), autoincrement=False, nullable=False),
    sa.Column('rel_lookup', mysql.VARCHAR(length=128), server_default=sa.text(u"''"), nullable=False),
    sa.Column('attribute', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('user_id', 'rel_lookup'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('user',
    sa.Column('user_id', mysql.INTEGER(display_width=10, unsigned=True), nullable=False),
    sa.Column('username', mysql.VARCHAR(length=128), nullable=True),
    sa.Column('email_address', mysql.VARCHAR(length=255), nullable=True),
    sa.Column('display_name', mysql.VARCHAR(length=50), nullable=True),
    sa.Column('signup_date', sa.DATE(), nullable=True),
    sa.Column('enroll_status', mysql.VARCHAR(length=50), server_default=sa.text(u"'PreValid'"), nullable=False),
    sa.Column('enroll_complete', mysql.TINYINT(display_width=1), server_default=sa.text(u"'0'"), autoincrement=False, nullable=True),
    sa.Column('tier', mysql.VARCHAR(length=50), server_default=sa.text(u"'Carbon'"), nullable=False),
    sa.Column('last_interaction_dttm', mysql.TIMESTAMP(), nullable=True),
    sa.Column('group_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('current_ohm_service_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('point_balance', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('credit_balance', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('donated_points', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('lifetime_points', mysql.DOUBLE(asdecimal=True), server_default=sa.text(u"'0'"), nullable=False),
    sa.Column('create_transaction_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=False, nullable=True),
    sa.Column('create_time', mysql.TIMESTAMP(), server_default=sa.text(u'CURRENT_TIMESTAMP'), nullable=True),
    sa.PrimaryKeyConstraint('user_id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )