1. Michael Bayer
  2. alembic
  3. Issues

Issues

Issue #56 resolved

'default' option of column is not supported

makoto kuwata
created an issue

It seems that 'default' option of column definition is not supported in alemblic 0.3.4.

For example:

{{{

!python

def upgrade(): op_create('homhom', Column('value', Integer, nullable=False, default=0)) }}}

And schema definition after 'alembic upgrade head': {{{ psql=> \d homhom Table "public.homhom" Column | Type | Modifiers --------+---------+----------- value | integer | not null }}}

The above shows that 'default' option is ignored in spite of column definition contains 'default' option.

Python: 2.7.3, PostgreSQL: 8.4, Alembic: 0.3.4, OS: MacOS X 10.6.8

Comments (3)

  1. Michael Bayer repo owner

    The SQLAlchemy `Column` construct uses `server_default` to indicate the "DEFAULT" clause at the DDL level - "default" indicates a Python side default that fires off when using the `insert()` construct which doesn't apply here. I've updated the docs which you can see at http://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.create_table and http://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.add_column.

  2. Log in to comment