Python sqlalchemy.dialects.mysql.SMALLINT Examples

The following are 3 code examples of sqlalchemy.dialects.mysql.SMALLINT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy.dialects.mysql , or try the search function .
Example #1
Source File: 4e0851c5f08_repo_stars_table.py    From gitmostwanted.com with MIT License 6 votes vote down vote up
def upgrade():
    op.create_table(
        'repos_stars',
        sa.Column('repo_id', sa.BigInteger(), nullable=False, primary_key=True),
        sa.Column('stars', mysql.SMALLINT(display_width=4, unsigned=True), nullable=False),
        sa.Column(
            'year',
            mysql.SMALLINT(display_width=4, unsigned=True),
            autoincrement=False, nullable=False, primary_key=True
        ),
        sa.Column(
            'day', mysql.SMALLINT(display_width=3, unsigned=True),
            autoincrement=False, nullable=False, primary_key=True
        ),
        sa.ForeignKeyConstraint(
            ['repo_id'], ['repos.id'], name='fk_repos_stars_repo_id', ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('repo_id', 'year', 'day')
    ) 
Example #2
Source File: cfb0ed4cced9_new_accounts_table.py    From cloud-inquisitor with Apache License 2.0 5 votes vote down vote up
def create_new_tables():
    op.create_table('account_types',
        sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True),
        sa.Column('account_type', sa.String(length=100), nullable=False),
        sa.PrimaryKeyConstraint('account_type_id')
    )
    op.create_index(op.f('ix_account_types_account_type'), 'account_types', ['account_type'], unique=True)

    op.create_table('accounts_new',
        sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('account_name', sa.String(length=256), nullable=False),
        sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('contacts', mysql.JSON(), nullable=False),
        sa.Column('enabled', mysql.SMALLINT(unsigned=True), nullable=False),
        sa.Column('required_roles', mysql.JSON(), nullable=True),
        sa.ForeignKeyConstraint(
            ('account_type_id',),
            ['account_types.account_type_id'],
            name='fk_account_account_type_id',
            ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('account_id')
    )
    op.create_index(op.f('ix_accounts_new_account_name'), 'accounts_new', ['account_name'], unique=True)
    op.create_index(op.f('ix_accounts_new_account_type_id'), 'accounts_new', ['account_type_id'], unique=False)

    op.create_table('account_properties',
        sa.Column('property_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True),
        sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('name', sa.String(length=50), nullable=False),
        sa.Column('value', mysql.JSON(), nullable=False),
        sa.ForeignKeyConstraint(
            ('account_id',),
            ['accounts_new.account_id'],
            name='fk_account_properties_account_id',
            ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('property_id', 'account_id')
    )
    op.create_index(op.f('ix_account_properties_account_id'), 'account_properties', ['account_id'], unique=False)
    op.create_index(op.f('ix_account_properties_name'), 'account_properties', ['name'], unique=False) 
Example #3
Source File: 286e2cdc37c9_worh_max_field.py    From gitmostwanted.com with MIT License 5 votes vote down vote up
def upgrade():
    op.add_column(
        'repos',
        sa.Column('worth_max', SMALLINT(display_width=2), server_default='0', nullable=False)
    )