I have this model:
class Counter(Base):
__tablename__ = 'counter'
name = Column(String(100), primary_key=True)
value = Column(Integer)
created_at = Column(DateTime, nullable=False, server_default=func.now())
updated_at = Column(DateTime, nullable=False, server_default=func.now(),
onupdate=func.now())
Generated Alembic migration is:
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('counter',
sa.Column('name', sa.String(length=100), nullable=False),
sa.Column('value', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default='now()', nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default='now()', nullable=False),
sa.PrimaryKeyConstraint('name')
)
### end Alembic commands ###
When applied the source on postgres server is this:
CREATE TABLE counter
(
name varchar(100) NOT NULL,
value integer,
created_at timestamp DEFAULT '2013-06-24 16:20:24.923475'::timestamp without time zone NOT NULL,
updated_at timestamp DEFAULT '2013-06-24 16:20:24.923475'::timestamp without time zone NOT NULL
);
Is this a bug or?