Re: adding an auto increment column to an existing table

2017-01-10 Thread Chris Withers
Okay, so this worked: op.execute(CreateSequence(Sequence("observation_id_seq"))) op.add_column('observation', sa.Column( 'id', sa.Integer(), nullable=False, server_default=sa.text("nextval('observation_id_seq'::regclass)") )) op.drop_constraint('observation_pkey',

adding an auto increment column to an existing table

2017-01-10 Thread Chris Withers
So, I screwed up and realised I really want an auto-incrementing integer as the primary key for a bunch of tables. I've changed my models, got all the tests passing and now I need to get the migrations done, I have: op.add_column('observation', sa.Column('id', sa.Integer(),